-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathmain.go
34 lines (25 loc) · 921 Bytes
/
main.go
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 (
"net/http"
"simplesurveygo/servicehandlers"
)
func main() {
// Serves the html pages
http.Handle("/", http.FileServer(http.Dir("./static")))
pingHandler := servicehandlers.PingHandler{}
authHandler := servicehandlers.UserValidationHandler{}
sessionHandler := servicehandlers.SessionHandler{}
surveyHandler := servicehandlers.SurveyHandler{}
userSurveyHandler := servicehandlers.UserSurveyHandler{}
#Handler := servicehandlers.#Handler{}
// Serves the API content
http.Handle("/api/v1/ping/", pingHandler)
http.Handle("/api/v1/#/", #Handler)
http.Handle("/api/v1/authenticate/", authHandler)
http.Handle("/api/v1/validate/", sessionHandler)
http.Handle("/api/v1/survey/{surveyname}", surveyHandler)
http.Handle("/api/v1/survey/", surveyHandler)
http.Handle("/api/v1/usersurvey/", userSurveyHandler)
// Start Server
http.ListenAndServe(":3000", nil)
}