Add GzipHandler

This commit is contained in:
Julian Kornberger 2016-03-20 19:40:03 +01:00
parent eb04fd0049
commit 9352ef7f12
1 changed files with 2 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import (
"github.com/FreifunkBremen/respond-collector/models" "github.com/FreifunkBremen/respond-collector/models"
"github.com/FreifunkBremen/respond-collector/respond" "github.com/FreifunkBremen/respond-collector/respond"
"github.com/FreifunkBremen/respond-collector/websocketserver" "github.com/FreifunkBremen/respond-collector/websocketserver"
"github.com/NYTimes/gziphandler"
) )
var ( var (
@ -47,7 +48,7 @@ func main() {
} }
if config.Webserver.Enable { if config.Webserver.Enable {
http.Handle("/", http.FileServer(http.Dir(config.Webserver.Webroot))) http.Handle("/", gziphandler.GzipHandler(http.FileServer(http.Dir(config.Webserver.Webroot))))
address := net.JoinHostPort(config.Webserver.Address, config.Webserver.Port) address := net.JoinHostPort(config.Webserver.Address, config.Webserver.Port)
log.Println("starting webserver on", address) log.Println("starting webserver on", address)