cors
This commit is contained in:
parent
0a2c2fdee3
commit
ee1be74eba
28
main.go
28
main.go
@ -31,24 +31,24 @@ func main() {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
//c := cors.New(cors.Options{
|
c := cors.New(cors.Options{
|
||||||
// AllowedOrigins: []string{"http://localhost:4000", "https://*.dariusklein.nl", "https://*.portfolio.dariusklein.nl", "https://dariusklein.nl"},
|
AllowedOrigins: []string{"http://localhost:4000", "https://*.dariusklein.nl", "https://*.portfolio.dariusklein.nl", "https://dariusklein.nl"},
|
||||||
// AllowedMethods: []string{
|
AllowedMethods: []string{
|
||||||
// http.MethodHead,
|
http.MethodHead,
|
||||||
// http.MethodGet,
|
http.MethodGet,
|
||||||
// http.MethodPost,
|
http.MethodPost,
|
||||||
// http.MethodPut,
|
http.MethodPut,
|
||||||
// http.MethodPatch,
|
http.MethodPatch,
|
||||||
// http.MethodDelete,
|
http.MethodDelete,
|
||||||
// },
|
},
|
||||||
// AllowedHeaders: []string{"*"},
|
AllowedHeaders: []string{"*"},
|
||||||
// AllowCredentials: true,
|
AllowCredentials: true,
|
||||||
//})
|
})
|
||||||
|
|
||||||
//init api routes
|
//init api routes
|
||||||
apiMux := api.Routes()
|
apiMux := api.Routes()
|
||||||
//run api server
|
//run api server
|
||||||
err = http.ListenAndServe(":4001", cors.AllowAll().Handler(apiMux))
|
err = http.ListenAndServe(":4001", c.Handler(apiMux))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user