This commit is contained in:
YuleiLan
2020-07-13 20:33:20 +08:00
commit cca0845f24
106 changed files with 17580 additions and 0 deletions

22
middleware/init.go Normal file
View File

@@ -0,0 +1,22 @@
package middleware
import (
"github.com/gin-gonic/gin"
)
func InitMiddleware(r *gin.Engine) {
// 日志处理
r.Use(LoggerToFile())
// 自定义错误处理
r.Use(CustomError)
// NoCache is a middleware function that appends headers
r.Use(NoCache)
// 跨域处理
r.Use(Options)
// Secure is a middleware function that appends security
r.Use(Secure)
// Set X-Request-Id header
r.Use(RequestId())
}