small town

This commit is contained in:
Mark Bates 2019-09-05 12:25:51 -04:00
parent b3ed58d6e9
commit 29b463b420
1 changed files with 8 additions and 1 deletions

View File

@ -23,7 +23,14 @@ func main() {
mux.Handle("/t", http.StripPrefix("/t", tmplHandler()))
mux.Handle("/", http.FileServer(pub))
log.Fatal(http.ListenAndServe(":3000", mux))
log.Fatal(http.ListenAndServe(":3000", logger(mux)))
}
func logger(h http.Handler) http.HandlerFunc {
return func(res http.ResponseWriter, req *http.Request) {
log.Println(req.Method, req.URL.String())
h.ServeHTTP(res, req)
}
}
func tmplHandler() http.HandlerFunc {