|
@@ -1011,23 +1011,27 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
|
)
|
|
|
|
|
|
server.AddRoutes(
|
|
|
- []rest.Route{
|
|
|
- {
|
|
|
- Method: http.MethodPost,
|
|
|
- Path: "/api/chat/create",
|
|
|
- Handler: chatrecords.SubmitApiChatHandler(serverCtx),
|
|
|
- },
|
|
|
- {
|
|
|
- Method: http.MethodPost,
|
|
|
- Path: "/api/chat/list",
|
|
|
- Handler: chatrecords.GetApiChatListHandler(serverCtx),
|
|
|
- },
|
|
|
- {
|
|
|
- Method: http.MethodPost,
|
|
|
- Path: "/api/chat/save",
|
|
|
- Handler: chatrecords.SaveApiChatHandler(serverCtx),
|
|
|
- },
|
|
|
- },
|
|
|
+ rest.WithMiddlewares(
|
|
|
+ []rest.Middleware{serverCtx.Miniprogram},
|
|
|
+ []rest.Route{
|
|
|
+ {
|
|
|
+ Method: http.MethodPost,
|
|
|
+ Path: "/api/chat/create",
|
|
|
+ Handler: chatrecords.SubmitApiChatHandler(serverCtx),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Method: http.MethodPost,
|
|
|
+ Path: "/api/chat/list",
|
|
|
+ Handler: chatrecords.GetApiChatListHandler(serverCtx),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Method: http.MethodPost,
|
|
|
+ Path: "/api/chat/save",
|
|
|
+ Handler: chatrecords.SaveApiChatHandler(serverCtx),
|
|
|
+ },
|
|
|
+ }...,
|
|
|
+ ),
|
|
|
+ rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
|
)
|
|
|
|
|
|
server.AddRoutes(
|