|
@@ -1,43 +1,44 @@
|
|
package route
|
|
package route
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "github.com/gin-gonic/gin"
|
|
|
|
+ "github.com/sirupsen/logrus"
|
|
"youngee_b_api/handler"
|
|
"youngee_b_api/handler"
|
|
"youngee_b_api/middleware"
|
|
"youngee_b_api/middleware"
|
|
- "youngee_b_api/model/http_model"
|
|
|
|
-
|
|
|
|
- "github.com/gin-gonic/gin"
|
|
|
|
)
|
|
)
|
|
|
|
|
|
func InitRoute(r *gin.Engine) {
|
|
func InitRoute(r *gin.Engine) {
|
|
|
|
|
|
- r.POST("/project/create", handler.WrapCreateProjectHandler)
|
|
|
|
- r.POST("/enterprise/create", handler.WrapCreateEnterpriseHandler)
|
|
|
|
- r.POST("/product/create", handler.WrapCreateProductHandler)
|
|
|
|
r.POST("/login", handler.WrapPasswordLoginHandler)
|
|
r.POST("/login", handler.WrapPasswordLoginHandler)
|
|
- r.GET("/test/ping", func(c *gin.Context) {
|
|
|
|
- resp := http_model.CommonResponse{
|
|
|
|
- Status: 0,
|
|
|
|
- Message: "",
|
|
|
|
- Data: "ping",
|
|
|
|
- }
|
|
|
|
- c.JSON(200, resp)
|
|
|
|
- })
|
|
|
|
- r.Any("/testDemo", func(c *gin.Context) {
|
|
|
|
- resp := http_model.CommonResponse{
|
|
|
|
- Status: 0,
|
|
|
|
- Message: "",
|
|
|
|
- Data: "pong",
|
|
|
|
- }
|
|
|
|
- c.JSON(200, resp)
|
|
|
|
- // 注意这里只是debug用的 接口要写成handler形式
|
|
|
|
- })
|
|
|
|
|
|
+ //r.GET("/test/ping", func(c *gin.Context) {
|
|
|
|
+ // resp := http_model.CommonResponse{
|
|
|
|
+ // Status: 0,
|
|
|
|
+ // Message: "",
|
|
|
|
+ // Data: "ping",
|
|
|
|
+ // }
|
|
|
|
+ // c.JSON(200, resp)
|
|
|
|
+ //})
|
|
|
|
+ //r.Any("/testDemo", func(c *gin.Context) {
|
|
|
|
+ // resp := http_model.CommonResponse{
|
|
|
|
+ // Status: 0,
|
|
|
|
+ // Message: "",
|
|
|
|
+ // Data: "pong",
|
|
|
|
+ // }
|
|
|
|
+ // c.JSON(200, resp)
|
|
|
|
+ // // 注意这里只是debug用的 接口要写成handler形式
|
|
|
|
+ //})
|
|
m := r.Group("/youngee/m")
|
|
m := r.Group("/youngee/m")
|
|
{
|
|
{
|
|
m.Use(middleware.LoginAuthMiddleware)
|
|
m.Use(middleware.LoginAuthMiddleware)
|
|
m.POST("/test", func(c *gin.Context) {
|
|
m.POST("/test", func(c *gin.Context) {
|
|
c.JSON(200, "ok")
|
|
c.JSON(200, "ok")
|
|
// 注意这里只是debug用的 接口要写成handler形式
|
|
// 注意这里只是debug用的 接口要写成handler形式
|
|
|
|
+ auth := middleware.GetSessionAuth(c)
|
|
|
|
+ logrus.Infof("auth:%+v", auth)
|
|
})
|
|
})
|
|
|
|
+ m.POST("/project/create", handler.WrapCreateProjectHandler)
|
|
|
|
+ m.POST("/enterprise/create", handler.WrapCreateEnterpriseHandler)
|
|
|
|
+ m.POST("/product/create", handler.WrapCreateProductHandler)
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|