package middleware import ( "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" ) func CORSMiddleware() gin.HandlerFunc { return cors.New(cors.Config{ AllowOrigins: []string{"http://localhost:5173", "http://127.0.0.1:5173"}, AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"}, AllowHeaders: []string{"Origin", "Content-Type", "Authorization"}, ExposeHeaders: []string{"Content-Length"}, AllowCredentials: true, }) }