-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
36 lines (29 loc) · 1.22 KB
/
main.go
File metadata and controls
36 lines (29 loc) · 1.22 KB
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
35
36
package main
import (
"fmt"
"net/http"
)
func main () {
http.Handle("/", http.FileServer(http.Dir("./frontend/dist")))
http.HandleFunc("/login", handleLogin)
http.HandleFunc("/register", handleRegister)
http.HandleFunc("/hasUserRegistered", handleHasUserRegistered)
http.HandleFunc("/isTokenValid", verifyJWT(handleIsTokenValid))
http.HandleFunc("/setSettings", verifyJWT(handleSettings))
http.HandleFunc("/changePassword", verifyJWT(handleChangePassword))
http.HandleFunc("/getTasks", verifyJWT(handleGetTasksByDate))
http.HandleFunc("/createTask", verifyJWT(handleCreateTask))
http.HandleFunc("/updateTask", verifyJWT(handleUpdateTaskStatus))
http.HandleFunc("/deleteTask", verifyJWT(handleDeleteTask))
http.HandleFunc("/getEvents", verifyJWT(handleGetEventsByDate))
http.HandleFunc("/createEvent", verifyJWT(handleCreateEvent))
http.HandleFunc("/deleteEvent", verifyJWT(handleDeleteEvent))
http.HandleFunc("/updateEvent", verifyJWT(handleUpdateEvent))
port := ":8080"
err := http.ListenAndServe(port,nil)
fmt.Println("Server started on port", port)
if err != nil {
fmt.Print("ERROR STARTING SERVER on port", port)
return
}
}