123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- // Code generated by goctl. DO NOT EDIT.
- // goctl 1.7.3
- package handler
- import (
- "net/http"
- room "microGame/app/usercenter/cmd/api/internal/handler/room"
- user "microGame/app/usercenter/cmd/api/internal/handler/user"
- "microGame/app/usercenter/cmd/api/internal/svc"
- "github.com/zeromicro/go-zero/rest"
- )
- func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
- server.AddRoutes(
- []rest.Route{
- {
- // bet room
- Method: http.MethodPost,
- Path: "/bet",
- Handler: room.BetHandler(serverCtx),
- },
- {
- // chat room
- Method: http.MethodPost,
- Path: "/chat",
- Handler: room.ChatHandler(serverCtx),
- },
- {
- // create room
- Method: http.MethodPost,
- Path: "/create",
- Handler: room.CreateRoomHandler(serverCtx),
- },
- {
- // join room
- Method: http.MethodPost,
- Path: "/join",
- Handler: room.JoinRoomHandler(serverCtx),
- },
- {
- // leave room
- Method: http.MethodPost,
- Path: "/leave",
- Handler: room.LeaveRoomHandler(serverCtx),
- },
- {
- // get room list
- Method: http.MethodPost,
- Path: "/list",
- Handler: room.RoomListHandler(serverCtx),
- },
- {
- // sitDown room
- Method: http.MethodPost,
- Path: "/sitdown",
- Handler: room.SitDownHandler(serverCtx),
- },
- {
- // standUp
- Method: http.MethodPost,
- Path: "/standup",
- Handler: room.StandUpHandler(serverCtx),
- },
- },
- rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
- rest.WithPrefix("/api/room"),
- )
- server.AddRoutes(
- rest.WithMiddlewares(
- []rest.Middleware{serverCtx.UserAgentMiddleware},
- []rest.Route{
- {
- // login
- Method: http.MethodPost,
- Path: "/login",
- Handler: user.LoginHandler(serverCtx),
- },
- {
- // register
- Method: http.MethodPost,
- Path: "/register",
- Handler: user.RegisterHandler(serverCtx),
- },
- }...,
- ),
- rest.WithPrefix("/api/user"),
- )
- server.AddRoutes(
- []rest.Route{
- {
- // get user info
- Method: http.MethodPost,
- Path: "/detail",
- Handler: user.DetailHandler(serverCtx),
- },
- {
- // get user info
- Method: http.MethodPost,
- Path: "/logout",
- Handler: user.LogoutHandler(serverCtx),
- },
- },
- rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
- rest.WithPrefix("/api/user"),
- )
- server.AddRoutes(
- []rest.Route{
- {
- // ws
- Method: http.MethodGet,
- Path: "/ws",
- Handler: user.WsHandler(serverCtx),
- },
- },
- rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
- rest.WithPrefix("/api"),
- )
- }
|