This commit is contained in:
toom1996
2026-08-26 19:40:16 +08:00
parent 30c9f21da4
commit a6724265ad
14 changed files with 400 additions and 101 deletions

View File

@ -36,7 +36,7 @@ func New(opt Options) *gin.Engine {
// 前端用 toAbs() 拼上 base 后直接访问,因此这里必须对外提供静态文件。
r.Static(opt.Config.Upload.URLPrefix, opt.Config.Upload.Dir)
api := r.Group("/api")
api := r.Group("/api/v1")
{
// 健康检查,供容器 / 反向代理探活
api.GET("/health", opt.Health.Check)
@ -52,10 +52,9 @@ func New(opt Options) *gin.Engine {
// 账号体系:注册 / 登录 / 登出 / 当前用户(JWT 无状态)
auth := api.Group("/auth")
{
auth.POST("/register", opt.Auth.Register)
auth.POST("/login", opt.Auth.Login)
auth.POST("/logout", opt.Auth.Logout)
auth.GET("/me", middleware.Auth(opt.JWT), opt.Auth.Me)
auth.POST("/register", opt.Auth.Register)
auth.POST("/login", opt.Auth.Login)
auth.GET("/me", middleware.Auth(opt.JWT), opt.Auth.Me)
}
}