38 lines
886 B
Go
38 lines
886 B
Go
// Code generated by goctl. DO NOT EDIT.
|
|
// goctl 1.9.2
|
|
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
file "juwan-backend/app/objectstory/api/internal/handler/file"
|
|
"juwan-backend/app/objectstory/api/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
)
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.FileSizeLimit},
|
|
[]rest.Route{
|
|
{
|
|
// 文件获取接口 (如果是私有文件,通过此接口获取或重定向)
|
|
Method: http.MethodGet,
|
|
Path: "/files/:fileId",
|
|
Handler: file.GetFileHandler(serverCtx),
|
|
},
|
|
{
|
|
// 文件上传接口
|
|
Method: http.MethodPost,
|
|
Path: "/upload",
|
|
Handler: file.UploadHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithJwt(serverCtx.Config.Logger.AccessSecret),
|
|
rest.WithPrefix("/api/v1"),
|
|
)
|
|
}
|