init.go 887 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package route
  2. import (
  3. "youngee_b_api/handler"
  4. "youngee_b_api/middleware"
  5. "youngee_b_api/model/http_model"
  6. "github.com/gin-gonic/gin"
  7. )
  8. func InitRoute(r *gin.Engine) {
  9. r.POST("/enterprise/create", handler.WrapCreateEnterpriceHandler)
  10. r.POST("/login", handler.WrapPasswordLoginHandler)
  11. r.GET("/test/ping", func(c *gin.Context) {
  12. resp := http_model.CommonResponse{
  13. Status: 0,
  14. Message: "",
  15. Data: "ping",
  16. }
  17. c.JSON(200, resp)
  18. })
  19. r.Any("/testDemo", func(c *gin.Context) {
  20. resp := http_model.CommonResponse{
  21. Status: 0,
  22. Message: "",
  23. Data: "pong",
  24. }
  25. c.JSON(200, resp)
  26. // 注意这里只是debug用的 接口要写成handler形式
  27. })
  28. m := r.Group("/youngee/m")
  29. {
  30. m.Use(middleware.LoginAuthMiddleware)
  31. m.POST("/test", func(c *gin.Context) {
  32. c.JSON(200, "ok")
  33. // 注意这里只是debug用的 接口要写成handler形式
  34. })
  35. }
  36. }