Add gzip compression for included assets
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
c458687f26
commit
a88b1e7a59
1 changed files with 4 additions and 3 deletions
7
main.go
7
main.go
|
@ -11,10 +11,11 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
http_helpers "github.com/Luzifer/go_helpers/http"
|
|
||||||
"github.com/Luzifer/rconfig"
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
http_helpers "github.com/Luzifer/go_helpers/http"
|
||||||
|
"github.com/Luzifer/rconfig"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -55,7 +56,7 @@ func main() {
|
||||||
|
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
api.Register(r.PathPrefix("/api").Subrouter())
|
api.Register(r.PathPrefix("/api").Subrouter())
|
||||||
r.PathPrefix("/").HandlerFunc(assetDelivery)
|
r.PathPrefix("/").HandlerFunc(http_helpers.GzipFunc(assetDelivery))
|
||||||
|
|
||||||
log.Fatalf("HTTP server quit: %s", http.ListenAndServe(cfg.Listen, http_helpers.NewHTTPLogHandler(r)))
|
log.Fatalf("HTTP server quit: %s", http.ListenAndServe(cfg.Listen, http_helpers.NewHTTPLogHandler(r)))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue