61 lines
1.3 KiB
Go
61 lines
1.3 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
// goctl 1.9.2
|
|
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
user "juwan-backend/app/users/api/internal/handler/user"
|
|
"juwan-backend/app/users/api/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
)
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.Logger},
|
|
[]rest.Route{
|
|
{
|
|
// 获取用户信息
|
|
Method: http.MethodGet,
|
|
Path: "/:userId",
|
|
Handler: user.GetUserInfoHandler(serverCtx),
|
|
},
|
|
{
|
|
// 修改用户信息
|
|
Method: http.MethodPut,
|
|
Path: "/:userId",
|
|
Handler: user.UpdateUserInfoHandler(serverCtx),
|
|
},
|
|
{
|
|
// 用户登出
|
|
Method: http.MethodPost,
|
|
Path: "/:userId/logout",
|
|
Handler: user.LogoutHandler(serverCtx),
|
|
},
|
|
{
|
|
// 修改用户密码
|
|
Method: http.MethodPut,
|
|
Path: "/:userId/password",
|
|
Handler: user.UpdatePasswordHandler(serverCtx),
|
|
},
|
|
{
|
|
// 用户登录接口
|
|
Method: http.MethodPost,
|
|
Path: "/login",
|
|
Handler: user.LoginHandler(serverCtx),
|
|
},
|
|
{
|
|
// 用户注册接口
|
|
Method: http.MethodPost,
|
|
Path: "/register",
|
|
Handler: user.RegisterHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/users"),
|
|
)
|
|
}
|