init.go 1009 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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("/project/create", handler.WrapCreateProjectHandler)
  10. r.POST("/enterprise/create", handler.WrapCreateEnterpriseHandler)
  11. r.POST("/product/create", handler.WrapCreateProductHandler)
  12. r.POST("/login", handler.WrapPasswordLoginHandler)
  13. r.GET("/test/ping", func(c *gin.Context) {
  14. resp := http_model.CommonResponse{
  15. Status: 0,
  16. Message: "",
  17. Data: "ping",
  18. }
  19. c.JSON(200, resp)
  20. })
  21. r.Any("/testDemo", func(c *gin.Context) {
  22. resp := http_model.CommonResponse{
  23. Status: 0,
  24. Message: "",
  25. Data: "pong",
  26. }
  27. c.JSON(200, resp)
  28. // 注意这里只是debug用的 接口要写成handler形式
  29. })
  30. m := r.Group("/youngee/m")
  31. {
  32. m.Use(middleware.LoginAuthMiddleware)
  33. m.POST("/test", func(c *gin.Context) {
  34. c.JSON(200, "ok")
  35. // 注意这里只是debug用的 接口要写成handler形式
  36. })
  37. }
  38. }