修改后端初始化

This commit is contained in:
2025-10-04 20:48:50 +08:00
parent 2dea178fde
commit 2afbafa192
13 changed files with 289 additions and 146 deletions

26
server/router/router.go Normal file
View File

@@ -0,0 +1,26 @@
package router
import (
"github.com/JACKYMYPERSON/hldrCenter/config"
handler "github.com/JACKYMYPERSON/hldrCenter/handler/uploadimg"
"github.com/gin-gonic/gin"
)
// SetupRouter 初始化路由
func SetupRouter(cfg *config.Config) *gin.Engine {
r := gin.Default()
// API路由组
api := r.Group("/api")
{
// 图片上传路由
api.POST("/upload/image", func(c *gin.Context) {
handler.UploadImageHandler(c, cfg)
})
api.POST("/upload/cover", func(c *gin.Context) {
handler.UploadImageHandler(c, cfg)
})
}
return r
}