From bd2ad6a11e0fed23a9e5ee3fc04bef4bdb3d20e0 Mon Sep 17 00:00:00 2001 From: Richard Huang Date: Wed, 13 May 2020 02:36:02 -0700 Subject: [PATCH] [server] Fix static file serving --- server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.go b/server.go index 7c9535c..5bb4279 100644 --- a/server.go +++ b/server.go @@ -15,10 +15,10 @@ func main() { defer a.DB.Close() r := mux.NewRouter() - r.Handle("/", http.FileServer(http.Dir("./static"))).Methods("GET") r.HandleFunc("/", a.CreateShortURL).Methods("POST") r.HandleFunc("/all", a.ListAll).Methods("GET") r.HandleFunc("/s/{alias:.*}", a.GetURL).Methods("GET") + r.PathPrefix("/").Handler(http.FileServer(http.Dir("./static/"))).Methods("GET") http.Handle("/", r) log.Println("Server is listening on port 8081")