[server] Fix static file serving

This commit is contained in:
Richard Huang 2020-05-13 02:36:02 -07:00
parent 2b42782842
commit bd2ad6a11e
No known key found for this signature in database
GPG key ID: FFDEF81D05C2EC94

View file

@ -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")