Add development CORS header when the "ENVIRONMENT" environment variable is set to "dev"

This commit is contained in:
TwinProduction committed 2021-01-24 04:48:07 -05:00
1 parent bc6ca2ebd0
commit f1aa5191bf
2 files changed
+15 -1

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
package controller
import "net/http"
func developmentCorsHandler(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "http://localhost:8081")
next.ServeHTTP(w, r)
})
}