mirror of
https://github.com/Luzifer/gziphttp.git
synced 2024-11-09 16:00:04 +00:00
Properly set up handler, add logging
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
3ac99ed5e3
commit
e3ee2400dc
1 changed files with 7 additions and 2 deletions
9
main.go
9
main.go
|
@ -41,6 +41,11 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
http.Handle("/", httphelper.GzipHandler(http.FileServer(http.Dir(cfg.ServeDir))))
|
http.Handle("/", http.FileServer(http.Dir(cfg.ServeDir)))
|
||||||
log.WithError(http.ListenAndServe(cfg.Listen, nil)).Error("HTTP server ended")
|
|
||||||
|
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")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue