Skip to content

Instantly share code, notes, and snippets.

@papisz
Last active July 5, 2018 21:50
Show Gist options
  • Save papisz/118d1a2f713d1b46ad1a02c30c96abfe to your computer and use it in GitHub Desktop.
Save papisz/118d1a2f713d1b46ad1a02c30c96abfe to your computer and use it in GitHub Desktop.
chi-urlparam-good-middleware
r := chi.NewRouter()
r.Route("/pets", func(r chi.Router) {
r.With(petMiddleware).Route("/{pet}", func(r chi.Router) {
r.Get("/", getPetHandler)
r.Put("/", putPetHandler)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment