change: refractored and seperated all code into different parts

This commit is contained in:
2025-02-12 14:56:01 +01:00
parent acf6638cad
commit 63677b90b9
8 changed files with 222 additions and 179 deletions

17
Backend/helper/web.go Normal file
View 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", "*")
}
}