dropped fiber for std http + gorilla websocket

Session serialization will use gob encoding instead of json.
Binary size will likely be reduced.
General backend code refactoring.
This commit is contained in:
2023-07-26 11:48:54 +02:00
parent 82b22db7ae
commit e1510d28d2
11 changed files with 351 additions and 251 deletions

15
server/middleware/cors.go Normal file
View File

@@ -0,0 +1,15 @@
package middlewares
import "net/http"
// Middleware for applying CORS policy for ALL hosts and for
// allowing ALL request headers.
func CORS(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
w.Header().Set("Access-Control-Allow-Headers", "*")
w.Header().Set("Access-Control-Allow-Credentials", "true")
next.ServeHTTP(w, r)
})
}