Skip to content

Commit

Permalink
fix rerouting
Browse files Browse the repository at this point in the history
Signed-off-by: slashexx <[email protected]>
  • Loading branch information
slashexx committed Dec 5, 2024
1 parent e08e940 commit f885a67
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/api-gateway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ type CodeRequest struct {
Language string `json:"language"`
Code string `json:"code"`
}

func enableCors(w http.ResponseWriter) {
w.Header().Set("Access-Control-Allow-Origin", "https://codebrewery.vercel.app")
w.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
w.Header().Set("Access-Control-Allow-Credentials", "true") // If required
}

func executeCode(w http.ResponseWriter, r *http.Request) {
fmt.Printf("Received %s request for %s\n", r.Method, r.URL.Path)
enableCors(w)
fmt.Printf("Received %s request for %s\n", r.Method, r.URL.Path)

if r.Method == http.MethodOptions {
w.WriteHeader(http.StatusOK)
Expand Down

0 comments on commit f885a67

Please sign in to comment.