From 97dd660925434be537cd9a49a1d0c893b223e357 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Fri, 6 Jan 2023 01:22:38 -0500 Subject: Refactor routing and handlers We were building a new gorilla mux on each connection, change that to an *http.ServeMux and build it once for the lifetime of the application. Tell redis to only cache GET requests. --- cmd/server/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/server/main.go') diff --git a/cmd/server/main.go b/cmd/server/main.go index f4f8dc3..d50c468 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -137,7 +137,7 @@ func main() { //nolint:funlen page.Funcs["ClearRedis"] = app.ClearRedis srv := &http.Server{ - Handler: app, + Handler: app.Handler(), Addr: listen, WriteTimeout: time.Duration(pageTimeout) * time.Second, ReadTimeout: time.Duration(pageTimeout) * time.Second, -- cgit v1.2.3