package routes import ( "github.com/gin-gonic/gin" "github.com/qit-team/snow-core/http/middleware" "qteam/app/http/controllers" "qteam/app/http/controllers/backend" "qteam/app/http/middlewares" "qteam/app/http/trace" "qteam/app/utils" "qteam/config" ) func RegisterAdminRoute(router *gin.Engine) { router.Use(middlewares.ServerRecovery(), middleware.GenRequestId, middleware.GenContextKit, middleware.AccessLog()) router.NoRoute(controllers.Error404) if len(config.GetConf().SkyWalkingOapServer) > 0 && config.IsEnvEqual(config.ProdEnv) { err := trace.InitTracer(config.GetConf().ServiceName, config.GetConf().SkyWalkingOapServer) if err != nil { utils.Log(nil, "InitTracer", err.Error()) } else { router.Use(middlewares.Trace()) } } //api := router.Group("/api") { //api.GET("/banner_list", controllers.GetBannerList) } v1 := router.Group("/backend/v1", middlewares.ValidateRequest()) products := v1.Group("/products", backend.ProductCreateHandler) products.POST("/create") products.GET("/query") products.PUT("/update") products.DELETE("/delete") }