27 lines
542 B
Go
27 lines
542 B
Go
|
|
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
|
||
|
|
}
|