package route import ( "github.com/gin-gonic/gin" "gold-shop/api/manage" "gold-shop/middleware" "gold-shop/utils/result" ) func adminRouteInit(r *gin.Engine) { manageGroup := r.Group("/manage") manageGroup.Use(middleware.CorsMiddleware("manage")) manageGroup.Match([]string{"POST", "OPTIONS"}, "/login", result.Json(manage.Login)) authGroup := manageGroup.Group("") authGroup.Use(middleware.JwtMiddleware("admin")) { authGroup.Match([]string{"GET", "OPTIONS"}, "/get-admin-info", result.Json(manage.GetAdminInfo)) authGroup.Match([]string{"POST", "OPTIONS"}, "/logout", result.Json(manage.Logout)) authGroup.Match([]string{"POST", "OPTIONS"}, "/add-admin", result.Json(manage.AddAdmin)) } }