You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
712 B

package mobile
import (
"net/http"
"recook/internal/api/mobile/file"
"recook/internal/back"
"recook/internal/gateway/app"
"github.com/gin-gonic/gin"
)
func Service() http.Handler {
e := gin.Default()
e.Use(gin.Recovery())
e.Use(app.CORS())
e.NoRoute(func(c *gin.Context) {
back.Fail(c, "请求不存在")
})
e.NoMethod(func(c *gin.Context) {
back.Fail(c, "方法不支持")
})
e.GET("/", func(c *gin.Context) {
c.JSON(
http.StatusOK,
gin.H{
"message": "welcome to recook",
},
)
})
v1 := e.Group("/api/v1")
{
// 裁剪 不裁剪的走ngx 也可以配置nginx裁剪组建
v1.GET("/static/photo/resize/*path", file.ResizePhotos)
app.SetupRouter(v1)
}
return e
}