diff --git a/main.go b/main.go index 51d7d58..9f40d9f 100644 --- a/main.go +++ b/main.go @@ -31,24 +31,24 @@ func main() { } }() - //c := cors.New(cors.Options{ - // AllowedOrigins: []string{"http://localhost:4000", "https://*.dariusklein.nl", "https://*.portfolio.dariusklein.nl", "https://dariusklein.nl"}, - // AllowedMethods: []string{ - // http.MethodHead, - // http.MethodGet, - // http.MethodPost, - // http.MethodPut, - // http.MethodPatch, - // http.MethodDelete, - // }, - // AllowedHeaders: []string{"*"}, - // AllowCredentials: true, - //}) + c := cors.New(cors.Options{ + AllowedOrigins: []string{"http://localhost:4000", "https://*.dariusklein.nl", "https://*.portfolio.dariusklein.nl", "https://dariusklein.nl"}, + AllowedMethods: []string{ + http.MethodHead, + http.MethodGet, + http.MethodPost, + http.MethodPut, + http.MethodPatch, + http.MethodDelete, + }, + AllowedHeaders: []string{"*"}, + AllowCredentials: true, + }) //init api routes apiMux := api.Routes() //run api server - err = http.ListenAndServe(":4001", cors.AllowAll().Handler(apiMux)) + err = http.ListenAndServe(":4001", c.Handler(apiMux)) if err != nil { log.Fatal(err) }