Skip to content

Commit

Permalink
handler ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
ianrose14 committed Nov 25, 2023
1 parent 136bde7 commit 25543ff
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cmd/webapp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand Down

0 comments on commit 25543ff

Please sign in to comment.