From 1316aa7ca5e1668bbb7967264540bff3c8dbef86 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sat, 16 May 2026 22:04:14 -0500 Subject: new api implemented server-side --- main.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'main.go') 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) } -- cgit v1.2.3