init: init refactor
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.10.1
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
file "sundynix-micro-go/app/file/api/internal/handler/file"
|
||||
"sundynix-micro-go/app/file/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: "/:id",
|
||||
Handler: file.GetFileByIdHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 删除文件
|
||||
Method: http.MethodDelete,
|
||||
Path: "/delete",
|
||||
Handler: file.DeleteFileHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 文件列表
|
||||
Method: http.MethodPost,
|
||||
Path: "/list",
|
||||
Handler: file.GetFileListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 上传文件
|
||||
Method: http.MethodPost,
|
||||
Path: "/upload",
|
||||
Handler: file.UploadFileHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/file"),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user