package handler
import (
"net/http"
user "gitcode.com/HuaweiCloudDeveloper/OpenSourceForHuaweiDemoGo/apps/user/api/internal/handler/user"
"gitcode.com/HuaweiCloudDeveloper/OpenSourceForHuaweiDemoGo/apps/user/api/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/health",
Handler: user.HealthHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/login",
Handler: user.LoginHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/register",
Handler: user.RegisterHandler(serverCtx),
},
},
rest.WithPrefix("/v1/user"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodDelete,
Path: "/delete",
Handler: user.DelHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/info",
Handler: user.DetailHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/update",
Handler: user.UpdateHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/v1/user"),
)
}