added static file serv
This commit is contained in:
parent
761701d2e9
commit
ca2b2c661c
@ -23,7 +23,7 @@ func StartWebserver(addr string, client client.Client) error {
|
|||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
|
|
||||||
r.HandleFunc("/{slug:[a-zA-Z0-9]{6}}", func(w http.ResponseWriter, r *http.Request) {
|
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) {
|
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")
|
}).Methods("DELETE")
|
||||||
|
|
||||||
|
r.PathPrefix("/").Handler(http.FileServer(http.Dir("./public/")))
|
||||||
|
|
||||||
logrus.Info("Starting webserver")
|
logrus.Info("Starting webserver")
|
||||||
return http.ListenAndServe(addr, r)
|
return http.ListenAndServe(addr, r)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user