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.
31 lines
556 B
31 lines
556 B
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
|
|
|
|
}
|