83 lines
1.7 KiB
Go
83 lines
1.7 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
// goctl 1.8.3
|
|
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"godemo/gateway/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
)
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/user/login",
|
|
Handler: loginHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/user/register",
|
|
Handler: registerHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/category/v1",
|
|
Handler: createCategoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/category/v1",
|
|
Handler: listCategoriesHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/category/v1/:id",
|
|
Handler: getCategoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/category/v1/:id",
|
|
Handler: updateCategoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/category/v1/:id",
|
|
Handler: deleteCategoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/category/v1/:id/tree",
|
|
Handler: getCategoryTreeHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/category/v1/system/:system_id",
|
|
Handler: getSystemCategoriesHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/user/:user_id",
|
|
Handler: getUserInfoHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/user/logout",
|
|
Handler: logoutHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
|
rest.WithPrefix("/api"),
|
|
)
|
|
}
|