From ca2b2c661caf5f4d2097640e632a1bad9f3db82c Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Tue, 10 May 2022 16:03:24 +0200 Subject: [PATCH] added static file serv --- internal/web/web.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/web/web.go b/internal/web/web.go index 44dbf4a..fae4088 100644 --- a/internal/web/web.go +++ b/internal/web/web.go @@ -23,7 +23,7 @@ func StartWebserver(addr string, client client.Client) error { r := mux.NewRouter() r.HandleFunc("/{slug:[a-zA-Z0-9]{6}}", func(w http.ResponseWriter, r *http.Request) { - + http.ServeFile(w, r, "./public/index.html") }) r.HandleFunc("/s/{slug:[a-zA-Z0-9]{6}}", func(w http.ResponseWriter, r *http.Request) { @@ -114,6 +114,8 @@ func StartWebserver(addr string, client client.Client) error { } }).Methods("DELETE") + r.PathPrefix("/").Handler(http.FileServer(http.Dir("./public/"))) + logrus.Info("Starting webserver") return http.ListenAndServe(addr, r) }