diff --git a/Frontend b/Frontend deleted file mode 160000 index 0d629d1..0000000 --- a/Frontend +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0d629d1da22ba3b1b425a87355ebf168dba3752b diff --git a/backend/main.go b/backend/main.go index 5bdb779..8902264 100644 --- a/backend/main.go +++ b/backend/main.go @@ -28,10 +28,25 @@ func main() { } } - // Register handlers with logging middleware - http.HandleFunc("/submit", loggingMiddleware(h.SubmitHandler)) - http.HandleFunc("/status", loggingMiddleware(h.StatusHandler)) - http.HandleFunc("/result", loggingMiddleware(h.ResultHandler)) + // Create a middleware for CORS + corsMiddleware := func(next http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + // Set CORS headers + w.Header().Set("Access-Control-Allow-Origin", "http://localhost:5173") + w.Header().Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS") + w.Header().Set("Access-Control-Allow-Headers", "Content-Type") + if r.Method == http.MethodOptions { + w.WriteHeader(http.StatusOK) + return + } + next(w, r) + } + } + + // Register handlers with logging and CORS middleware + http.HandleFunc("/submit", corsMiddleware(loggingMiddleware(h.SubmitHandler))) + http.HandleFunc("/status", corsMiddleware(loggingMiddleware(h.StatusHandler))) + http.HandleFunc("/result", corsMiddleware(loggingMiddleware(h.ResultHandler))) port := ":8080" log.Printf("Server started at %s", port) diff --git a/backend/tmp/main.exe b/backend/tmp/main.exe index 5e1b8a0..7807f82 100644 Binary files a/backend/tmp/main.exe and b/backend/tmp/main.exe differ