aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/main.go b/main.go
index e85649d..2f39712 100644
--- a/main.go
+++ b/main.go
@@ -30,15 +30,16 @@ func main() {
apiKey = os.Getenv("API_KEY")
// setup routes
- setupRoutesAPI()
- setupRoutesWatch()
+ mux := http.NewServeMux()
+ registerRoutesAPI(mux, &APISourceOfficial{})
+ registerRoutesWatch(mux)
setupHome()
- http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
- http.HandleFunc("/", rootHandler)
+ mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
+ mux.HandleFunc("/", rootHandler)
// start http server
log.Println("Listening on http://localhost:8080")
- err := http.ListenAndServe(":8080", nil)
+ err := http.ListenAndServe(":8080", mux)
if err != nil {
log.Fatal(err)
}