增加启动静态资源服务器方法
This commit is contained in:
25
gin/static/static.go
Normal file
25
gin/static/static.go
Normal file
@ -0,0 +1,25 @@
|
||||
// Package static ...
|
||||
//
|
||||
// Description : 启动静态资源服务器
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2021/12/24 2:14 PM
|
||||
package static
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Register 静态资源服务器
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2:17 PM 2021/12/24
|
||||
func Register(router *gin.Engine, ruleList []*MapRule) {
|
||||
for _, rule := range ruleList {
|
||||
router.StaticFS(rule.URIPrefix, http.Dir(rule.StaticDirPath))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user