mirror of
https://github.com/metosin/reitit.git
synced 2025-12-16 16:01:11 +00:00
doc: add a reason to use top-level mw
This commit is contained in:
parent
ad9cd31168
commit
9ee8e364f3
1 changed files with 1 additions and 0 deletions
|
|
@ -241,6 +241,7 @@ using all of the above techniques:
|
||||||
|
|
||||||
## Which method should I use for defining middleware?
|
## Which method should I use for defining middleware?
|
||||||
|
|
||||||
|
- If you have middleware that you want to apply to the default handler (second argument of `ring/ring-handler`), use _top-level middleware_
|
||||||
- If you have a generic middleware, that doesn't depend on the route, use _top-level middleware_ or _top-level route data_
|
- If you have a generic middleware, that doesn't depend on the route, use _top-level middleware_ or _top-level route data_
|
||||||
- If you are using top-level route data anyway for some other reasons, it might be clearest to have all the middleware there. This is what most of the reitit examples do.
|
- If you are using top-level route data anyway for some other reasons, it might be clearest to have all the middleware there. This is what most of the reitit examples do.
|
||||||
- If you want to apply a middleware to only a couple of routes, use _nested middleware_ (ie. _route data_)
|
- If you want to apply a middleware to only a couple of routes, use _nested middleware_ (ie. _route data_)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue