Spaces:
Sleeping
Sleeping
| // internal/shared/middleware/cors.go | |
| package middleware | |
| import ( | |
| "net/http" | |
| "os" | |
| "github.com/go-chi/cors" | |
| ) | |
| func CORS() func(http.Handler) http.Handler { | |
| return cors.Handler(cors.Options{ | |
| AllowedOrigins: []string{os.Getenv("FRONTEND_ORIGIN")}, | |
| AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, | |
| AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-XSRF-TOKEN"}, | |
| ExposedHeaders: []string{"X-XSRF-TOKEN"}, | |
| AllowCredentials: true, | |
| MaxAge: 300, | |
| }) | |
| } | |