package routers import ( "github.com/gin-gonic/gin" "net/http" "niupicUpload/routers/upload" ) /* * @author: sre @date: 2022/8/19 0019 @desc: routers * */ func Router() *gin.Engine { router := gin.Default() //静态资源 router = StaticRouter(router) //upload router = upload.Upload(router) return router } func StaticRouter(r *gin.Engine) *gin.Engine { //static 加载静态资源,一般是上传的资源,例如用户上传的图片 r.StaticFS("/", http.Dir("static")) //r.StaticFile("/favicon.ico", "static/favicon.ico") return r }