From fb63b07e950004068bc883818f84c9ddbbb9be02 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Sat, 11 May 2019 02:40:49 -0400 Subject: gzipped responses --- go.mod | 2 ++ go.sum | 2 ++ main.go | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 go.sum diff --git a/go.mod b/go.mod index dca5daf..5da3388 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ module github.com/gbmor/getwtxt go 1.11 + +require github.com/gorilla/handlers v1.4.0 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..d4945cc --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/gorilla/handlers v1.4.0 h1:XulKRWSQK5uChr4pEgSE4Tc/OcmnU9GJuSwdog/tZsA= +github.com/gorilla/handlers v1.4.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= diff --git a/main.go b/main.go index 83344d0..374b94f 100644 --- a/main.go +++ b/main.go @@ -3,12 +3,16 @@ package main import ( "log" "net/http" + + "github.com/gorilla/handlers" ) func main() { log.Printf("getwtxt v0.1\n") - http.HandleFunc("/api/", apiHandler) + serv := http.NewServeMux() + + serv.HandleFunc("/api/", apiHandler) - log.Fatalln(http.ListenAndServe(":8080", nil)) + log.Fatalln(http.ListenAndServe(":8080", handlers.CompressHandler(serv))) } -- cgit 1.4.1-2-gfad0