1
0
mirror of https://github.com/Luzifer/gziphttp.git synced 2024-09-19 00:13:00 +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")
}