From 775914223cb4ffb878db953453464ac36091ab50 Mon Sep 17 00:00:00 2001 From: Subhodip Ghosh Date: Mon, 23 Jun 2025 15:10:51 +0000 Subject: [PATCH] Update main.go --- main.go | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/main.go b/main.go index 0bc59b3..375fff7 100644 --- a/main.go +++ b/main.go @@ -12,7 +12,6 @@ import ( "github.com/joho/godotenv" _ "github.com/mattn/go-sqlite3" "github.com/google/uuid" - "github.com/rs/cors" ) type Config struct { @@ -111,29 +110,13 @@ func saveImageNames() { } func serveAPI() { - // Create a new CORS handler - c := cors.New(cors.Options{ - AllowedOrigins: []string{ - "http://localhost:4321", - "https://siliconpin.cs1.hz.siliconpin.com", - "https://siliconpin.com", - }, - AllowedMethods: []string{"GET", "POST", "OPTIONS"}, - AllowedHeaders: []string{"Content-Type"}, - AllowCredentials: true, - // Debug: true, // Remove in production - }) - // Create a new mux router router := http.NewServeMux() router.HandleFunc("/get-image", getImageHandler) router.HandleFunc("/save-score", saveScoreHandler) - // Wrap your router with the CORS handler - handler := c.Handler(router) - log.Printf("Server starting on port %s", config.Port) - log.Fatal(http.ListenAndServe(config.Port, handler)) + log.Fatal(http.ListenAndServe(":"+config.Port, router)) } func getImageHandler(w http.ResponseWriter, r *http.Request) {