add client and groups member logic

This commit is contained in:
2026-03-27 18:49:45 +01:00
parent a95bc43be6
commit c5fc74d142
9 changed files with 256 additions and 70 deletions
+11 -4
View File
@@ -6,14 +6,21 @@ import (
"net/http"
)
func withCORS(h http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
h(w, r)
}
}
func main() {
ctx := context.Background()
DbInit(ctx)
http.HandleFunc("/newuser", HttpHandleNewUser)
http.HandleFunc("/login", HttpHandleLogin)
http.HandleFunc("/group/create", HttpHandleGroupCreate)
http.HandleFunc("/group/addclient", HttpHandleGroupAddClient)
http.HandleFunc("/new/client", withCORS(HttpHandleNewUser))
http.HandleFunc("/new/token", withCORS(HttpHandleLogin))
http.HandleFunc("/new/group", withCORS(HttpHandleGroupCreate))
http.HandleFunc("/mod/group/addclients", withCORS(HttpHandleGroupAddClient))
http.HandleFunc("/ws", ServeWsConnection)
log.Println("listening on :8080")