You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mux is powerful thanks to regex, but regex can be a wall to some users. We need to document these better.
e.g.
r.HandleFunc("/foo{format:(.json)?}", Handler) allows you to handle optional extensions—a useful pattern. You could also do {format:(.json|.capnp|.raw)?} if you wanted as well.
PathPrefix + static files (this comes up a lot)
Naming routes.
Unit testing handlers
Writing per-route and whole-of-router middleware - func New() func(http.Handler) http.Handler vs func Thing(http.Handler) http.Handler vs func Thing(arg string, h http.Handler) http.Handler`
The text was updated successfully, but these errors were encountered:
(this confused the heck out of me while trying to use Gorilla)
* Changed `request` to be just `r`, like the other handlers.
* Created complete wrapper function instead of just 2 lines.
mux
is powerful thanks to regex, but regex can be a wall to some users. We need to document these better.e.g.
r.HandleFunc("/foo{format:(.json)?}", Handler)
allows you to handle optional extensions—a useful pattern. You could also do{format:(.json|.capnp|.raw)?}
if you wanted as well.func New() func(http.Handler) http.Handler
vsfunc Thing(http.Handler) http.Handler
vs func Thing(arg string, h http.Handler) http.Handler`The text was updated successfully, but these errors were encountered: