mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-20 17:57:54 +00:00
23 lines
453 B
Go
23 lines
453 B
Go
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())
|
|
}
|