add client and groups member logic
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user