From 6eaaeba81d07477f3440f0c8254de3889f2401e0 Mon Sep 17 00:00:00 2001 From: DutchEllie Date: Thu, 24 Mar 2022 14:31:02 +0100 Subject: [PATCH] Compressing handlergit add . --- go.mod | 10 ++++++++-- go.sum | 4 ++++ src/main.go | 4 +++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index fec5d97..7fca61f 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,12 @@ module dutchellie.nl/DutchEllie/proper-website-2 go 1.17 -require github.com/maxence-charriere/go-app/v9 v9.3.3 +require ( + github.com/gorilla/handlers v1.5.1 + github.com/maxence-charriere/go-app/v9 v9.3.3 +) -require github.com/google/uuid v1.3.0 // indirect +require ( + github.com/felixge/httpsnoop v1.0.1 // indirect + github.com/google/uuid v1.3.0 // indirect +) diff --git a/go.sum b/go.sum index e2f5cac..2c5a623 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,13 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= +github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/gomarkdown/markdown v0.0.0-20210408062403-ad838ccf8cdd/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= +github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/maxence-charriere/go-app/v9 v9.3.3 h1:vo+1oohWMfTQ0S3eg9JOjuFEy1n3bVNgeDi4eHNfMzA= github.com/maxence-charriere/go-app/v9 v9.3.3/go.mod h1:zo0n1kh4OMKn7P+MrTUUi7QwUMU2HOfHsZ293TITtxI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/src/main.go b/src/main.go index 4914d5b..fa60282 100644 --- a/src/main.go +++ b/src/main.go @@ -4,6 +4,7 @@ import ( "log" "net/http" + "github.com/gorilla/handlers" "github.com/maxence-charriere/go-app/v9/pkg/app" ) @@ -78,7 +79,8 @@ func main() { } app.GenerateStaticWebsite("./staticsite", handler) - http.Handle("/", handler) + compressed := handlers.CompressHandler(handler) + http.Handle("/", compressed) if err := http.ListenAndServe(":8000", nil); err != nil { log.Fatal(err)