fix
This commit is contained in:
6
main.go
6
main.go
@@ -6,7 +6,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
|
||||
"main/db"
|
||||
"main/handler"
|
||||
"net/http"
|
||||
@@ -72,6 +71,7 @@ func registerHnadler(w http.ResponseWriter, r *http.Request) {
|
||||
_, err := db.UserCollection.InsertOne(context.TODO(), user)
|
||||
if err != nil {
|
||||
http.Error(w, `{"message": "Could not create user"}`, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
@@ -129,12 +129,12 @@ func main() {
|
||||
//handler.RegsiterClusterRoute(router)
|
||||
// Enable CORS
|
||||
c := cors.New(cors.Options{
|
||||
AllowedOrigins: []string{"*"}, // Allow all origins
|
||||
AllowedOrigins: []string{"*"}, // Allow all origins
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
||||
AllowedHeaders: []string{"Content-Type", "Authorization", "X-Requested-With", "Accept", "Origin"},
|
||||
ExposedHeaders: []string{"Content-Length"},
|
||||
AllowCredentials: true,
|
||||
Debug: true, // Enable debug logging
|
||||
Debug: true, // Enable debug logging
|
||||
})
|
||||
|
||||
http.ListenAndServe("0.0.0.0:8082", c.Handler(router))
|
||||
|
||||
Reference in New Issue
Block a user