start minIO, refactored files into packages
This commit is contained in:
@@ -4,6 +4,10 @@ import (
|
||||
"context"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
http2 "go-socket/packages/http"
|
||||
"go-socket/packages/postgresql"
|
||||
"go-socket/packages/wsServer"
|
||||
)
|
||||
|
||||
func withCORS(h http.HandlerFunc) http.HandlerFunc {
|
||||
@@ -15,23 +19,23 @@ func withCORS(h http.HandlerFunc) http.HandlerFunc {
|
||||
|
||||
func main() {
|
||||
ctx := context.Background()
|
||||
PgInit(ctx)
|
||||
postgresql.PgInit(ctx)
|
||||
|
||||
http.HandleFunc("/new/user", withCORS(HttpHandleUserNew))
|
||||
http.HandleFunc("/new/connection", withCORS(HttpHandleUserNewConnection))
|
||||
http.HandleFunc("/new/token", withCORS(HttpHandleUserNewToken))
|
||||
http.HandleFunc("/mod/user/appearence", withCORS(HttpHandleUserModifyAppearance))
|
||||
http.HandleFunc("/mod/user/about", withCORS(HttpHandleUserModifyAbout))
|
||||
http.HandleFunc("/mod/connection/accept", withCORS(HttpHandleUserElevateConnection))
|
||||
http.HandleFunc("/new/user", withCORS(http2.HandleUserNew))
|
||||
http.HandleFunc("/new/connection", withCORS(http2.HandleUserNewConnection))
|
||||
http.HandleFunc("/new/token", withCORS(http2.HandleUserNewToken))
|
||||
http.HandleFunc("/mod/user/appearence", withCORS(http2.HandleUserModifyAppearance))
|
||||
http.HandleFunc("/mod/user/about", withCORS(http2.HandleUserModifyAbout))
|
||||
http.HandleFunc("/mod/connection/accept", withCORS(http2.HandleUserElevateConnection))
|
||||
|
||||
http.HandleFunc("/get/connections", withCORS(HttpHandleUserGetConnections))
|
||||
http.HandleFunc("/get/connection/messages", withCORS(HttpHandleUserGetConnectionMessages))
|
||||
http.HandleFunc("/get/connections", withCORS(http2.HandleUserGetConnections))
|
||||
http.HandleFunc("/get/connection/messages", withCORS(http2.HandleUserGetConnectionMessages))
|
||||
|
||||
http.HandleFunc("/del/user", withCORS(HttpHandleUserDelete))
|
||||
http.HandleFunc("/del/connection", withCORS(HttpHandleUserDeleteConnection))
|
||||
http.HandleFunc("/del/user", withCORS(http2.HandleUserDelete))
|
||||
http.HandleFunc("/del/connection", withCORS(http2.HandleUserDeleteConnection))
|
||||
|
||||
http.HandleFunc("/msg/user", withCORS(HttpHandleDm))
|
||||
http.HandleFunc("/ws", ServeWsConnection)
|
||||
http.HandleFunc("/msg/user", withCORS(http2.HandleDm))
|
||||
http.HandleFunc("/ws", wsServer.ServeWsConnection)
|
||||
|
||||
log.Println("listening on :8080")
|
||||
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||
|
||||
Reference in New Issue
Block a user