tsk-4: Adding CORS support (#53)

Closes #4

Reviewed-on: phoenix/textsender-api#53
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
phoenix
2025-12-21 00:28:17 +00:00
committed by phoenix
parent 69b5f4ff89
commit f5f753fe02
5 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ func main() {
// Configure CORS
router.Use(cors.Handler(cors.Options{
AllowedOrigins: []string{fmt.Sprintf("http://localhost:%s", config.PORT), "http://localhost:5173", "https://textsender.com"},
AllowedOrigins: cfg.AllowedOrigins,
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"},
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"},
ExposedHeaders: []string{"Link", "X-Total-Count"},