feat: 初始化项目路由

This commit is contained in:
unclesam committed 2026-07-07 21:44:41 +08:00
1 parent 4cec3f131a
commit 92a9e20934
11 files changed
+91 -83

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
package middleware
import (
"EnGin/internal/global"
"time"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
func CORS() gin.HandlerFunc {
return cors.New(cors.Config{
AllowOrigins: global.Config.Server.AllowOrigins,
AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"},
AllowHeaders: []string{"Origin", "Content-Type", "Accept", "X-Source", "access_token", "refresh_token"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
MaxAge: 12 * time.Hour,
})
}