1
0
Fork 0
mirror of https://github.com/Luzifer/gziphttp.git synced 2024-12-20 19:21:17 +00:00

Properly set up handler, add logging

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-10-19 20:30:39 +02:00
parent 3ac99ed5e3
commit e3ee2400dc
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -41,6 +41,11 @@ func init() {
}
func main() {
http.Handle("/", httphelper.GzipHandler(http.FileServer(http.Dir(cfg.ServeDir))))
log.WithError(http.ListenAndServe(cfg.Listen, nil)).Error("HTTP server ended")
http.Handle("/", http.FileServer(http.Dir(cfg.ServeDir)))
var handler http.Handler = http.DefaultServeMux
handler = httphelper.GzipHandler(handler)
handler = httphelper.NewHTTPLogHandler(handler)
log.WithError(http.ListenAndServe(cfg.Listen, handler)).Error("HTTP server ended")
}