change: refractored and seperated all code into different parts
This commit is contained in:
17
Backend/helper/web.go
Normal file
17
Backend/helper/web.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package helper
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
// setting cors, important for later frontend use
|
||||
//
|
||||
// in DEBUG == "true" everything is set to "*" so that no cors errors will be happen
|
||||
func SetCors(w http.ResponseWriter) {
|
||||
if os.Getenv("DEBUG") == "true" {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
w.Header().Set("Access-Control-Allow-Methods", "*")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "*")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user