-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (30 loc) · 752 Bytes
/
main.go
File metadata and controls
34 lines (30 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"log"
"net/http"
handlers "phaint/internal/handlers"
"phaint/internal/services"
)
func main() {
err := services.FirebaseDb().Connect()
if err != nil {
log.Println(err)
}
if err != nil {
log.Println(err)
}
log.Println("Creating the server on port 8080")
mux := http.NewServeMux()
// adding all the handlers
mux.Handle("/users", &handlers.UserHandler{})
mux.Handle("/projects", &handlers.ProjectHandler{})
mux.Handle("/invitations/accept", &handlers.InvitationHandler{})
mux.Handle("/invitations", &handlers.InvitationHandler{})
// Add WebSocket handler
mux.Handle("/connect", &handlers.WebSocketHandler{})
// Run the server
err = http.ListenAndServe(":8080", mux)
if err != nil {
log.Panic(err)
}
}