From 25543ffdc5658e68e7881fd3ac98b0d69fffdd67 Mon Sep 17 00:00:00 2001 From: Ian Rose Date: Fri, 24 Nov 2023 21:39:37 -0500 Subject: [PATCH] handler ordering --- cmd/webapp/main.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/webapp/main.go b/cmd/webapp/main.go index 9069440..5ccbb90 100644 --- a/cmd/webapp/main.go +++ b/cmd/webapp/main.go @@ -113,16 +113,18 @@ func main() { mux.HandleFunc("/dump/", svr.dumpHandler) stravaDb := strava.NewSqliteDb(db) - h := func(w http.ResponseWriter, r *http.Request) { - log.Printf("basic strava request to %v", r.URL) - strava.Handler(w, r, stravaTemplate, stravaDb, stravaAccount) - } - mux.HandleFunc("/running/", h) - mux.HandleFunc("/strava/", h) http.HandleFunc("/strava/exchange_token/", func(w http.ResponseWriter, r *http.Request) { log.Printf("token exchange strava request to %v", r.URL) strava.TokenHandler(w, r, stravaDb, stravaAccount) }) + { + h := func(w http.ResponseWriter, r *http.Request) { + log.Printf("basic strava request to %v", r.URL) + strava.Handler(w, r, stravaTemplate, stravaDb, stravaAccount) + } + mux.HandleFunc("/running/", h) + mux.HandleFunc("/strava/", h) + } mux.Handle("/favicon.ico", httpFS(staticFS, "static"))