aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2026-05-16 22:04:14 -0500
committerTim Keller <tjk@tjkeller.xyz>2026-05-16 22:04:14 -0500
commit1316aa7ca5e1668bbb7967264540bff3c8dbef86 (patch)
treecc6a4121c13d31a96060e3fa9103ed314578c8cc /main.go
parent3bfeed5a50cd1bb405cbe145611410fa4f628413 (diff)
downloadembedtube-1316aa7ca5e1668bbb7967264540bff3c8dbef86.tar.xz
embedtube-1316aa7ca5e1668bbb7967264540bff3c8dbef86.zip
new api implemented server-side
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)
}