refactor 🎨: admin中的公共中间件,提到common

This commit is contained in:
linwenxiang committed 2021-03-29 09:05:05 +08:00
1 parent 495a9c54aa
commit dd16744676
11 files changed
+621

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
package middleware
import (
"github.com/gin-gonic/gin"
)
func InitMiddleware(r *gin.Engine) {
// 数据库链接
r.Use(WithContextDb)
// 日志处理
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)
// 链路追踪
//r.Use(middleware.Trace())
}