mirror of
https://github.com/metosin/reitit.git
synced 2026-01-04 15:28:24 +00:00
Document the router options
This commit is contained in:
parent
dd6b07aa0f
commit
883a65acca
5 changed files with 33 additions and 43 deletions
|
|
@ -129,23 +129,22 @@
|
|||
|
||||
(defn router
|
||||
"Creates a [[reitit.core/Router]] from raw route data and optionally an options map with
|
||||
support for Interceptors. See [docs](https://metosin.github.io/reitit/) for details.
|
||||
|
||||
Example:
|
||||
|
||||
(router
|
||||
[\"/api\" {:interceptors [format-body oauth2]}
|
||||
[\"/users\" {:interceptors [delete]
|
||||
:handler get-user}]])
|
||||
support for Interceptors. See documentation on [[reitit.core/router]] for available options.
|
||||
In addition, the following options are available:
|
||||
|
||||
Options:
|
||||
|
||||
| key | description
|
||||
| --------------------------------|-------------
|
||||
| `:reitit.interceptor/transform` | Function of [Interceptor] => [Interceptor] to transform the expanded Interceptors (default: identity).
|
||||
| `:reitit.interceptor/transform` | Function or vector of functions of type `[Interceptor] => [Interceptor]` to transform the expanded Interceptors (default: identity).
|
||||
| `:reitit.interceptor/registry` | Map of `keyword => IntoInterceptor` to replace keyword references into Interceptor
|
||||
|
||||
See router options from [[reitit.core/router]]."
|
||||
Example:
|
||||
|
||||
(router
|
||||
[\"/api\" {:interceptors [format-body oauth2]}
|
||||
[\"/users\" {:interceptors [delete]
|
||||
:handler get-user}]])"
|
||||
([data]
|
||||
(router data nil))
|
||||
([data opts]
|
||||
|
|
|
|||
|
|
@ -122,23 +122,20 @@
|
|||
|
||||
(defn router
|
||||
"Creates a [[reitit.core/Router]] from raw route data and optionally an options map with
|
||||
support for Middleware. See [docs](https://metosin.github.io/reitit/) for details.
|
||||
support for Middleware. See documentation on [[reitit.core/router]] for available options.
|
||||
In addition, the following options are available:
|
||||
|
||||
| key | description
|
||||
| -------------------------------|-------------
|
||||
| `:reitit.middleware/transform` | Function or vector of functions of type `[Middleware] => [Middleware]` to transform the expanded Middleware (default: identity)
|
||||
| `:reitit.middleware/registry` | Map of `keyword => IntoMiddleware` to replace keyword references into Middleware
|
||||
|
||||
Example:
|
||||
|
||||
(router
|
||||
[\"/api\" {:middleware [wrap-format wrap-oauth2]}
|
||||
(router
|
||||
[\"/api\" {:middleware [wrap-format wrap-oauth2]}
|
||||
[\"/users\" {:middleware [wrap-delete]
|
||||
:handler get-user}]])
|
||||
|
||||
Options:
|
||||
|
||||
| key | description |
|
||||
| -------------------------------|-------------|
|
||||
| `:reitit.middleware/transform` | Function of `[Middleware] => [Middleware]` to transform the expanded Middleware (default: identity).
|
||||
| `:reitit.middleware/registry` | Map of `keyword => IntoMiddleware` to replace keyword references into Middleware
|
||||
|
||||
See other router options from [[reitit.core/router]]."
|
||||
:handler get-user}]])"
|
||||
([data]
|
||||
(router data nil))
|
||||
([data opts]
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
(defn router
|
||||
"Create a `reitit.core.router` from raw route data and optionally an options map.
|
||||
Enables request coercion. See [[reitit.core.router]] for details on options."
|
||||
Enables request coercion. See [[reitit.core/router]] for details on options."
|
||||
([raw-routes]
|
||||
(router raw-routes {}))
|
||||
([raw-routes opts]
|
||||
|
|
|
|||
|
|
@ -47,15 +47,13 @@
|
|||
|
||||
(defn router
|
||||
"Creates a [[reitit.core/Router]] from raw route data and optionally an options map with
|
||||
support for http-methods and Interceptors. See [docs](https://metosin.github.io/reitit/)
|
||||
for details.
|
||||
support for http-methods and Interceptors. See documentation on [[reitit.core/router]]
|
||||
for available options. In addition, the following options are available:
|
||||
|
||||
Options:
|
||||
|
||||
| key | description |
|
||||
| ---------------------------------------|-------------|
|
||||
| `:reitit.interceptor/transform` | Function of `[Interceptor] => [Interceptor]` to transform the expanded Interceptors (default: identity).
|
||||
| `:reitit.interceptor/registry` | Map of `keyword => IntoInterceptor` to replace keyword references into Interceptors
|
||||
| key | description
|
||||
| ---------------------------------------|-------------
|
||||
| `:reitit.interceptor/transform` | Function or vector of functions of type `[Interceptor] => [Interceptor]` to transform the expanded Interceptors (default: identity)
|
||||
| `:reitit.interceptor/registry` | Map of `keyword => IntoInterceptor` to replace keyword references into Interceptors
|
||||
| `:reitit.http/default-options-handler` | Default handler for `:options` method in endpoints (default: reitit.ring/default-options-handler)
|
||||
|
||||
Example:
|
||||
|
|
@ -65,9 +63,7 @@
|
|||
[\"/users\" {:get get-user
|
||||
:post update-user
|
||||
:delete {:interceptors [delete-i]
|
||||
:handler delete-user}}]])
|
||||
|
||||
See router options from [[reitit.core/router]] and [[reitit.middleware/router]]."
|
||||
:handler delete-user}}]])"
|
||||
([data]
|
||||
(router data nil))
|
||||
([data opts]
|
||||
|
|
@ -112,7 +108,7 @@
|
|||
| `:executor` | `reitit.interceptor.Executor` for the interceptor chain
|
||||
| `:interceptors` | Optional sequence of interceptors that are always run before any other interceptors, even for the default handler"
|
||||
([router opts]
|
||||
(ring-handler router nil opts))
|
||||
(ring-handler router nil opts))
|
||||
([router default-handler {:keys [executor interceptors]}]
|
||||
(let [default-handler (or default-handler (fn ([_]) ([_ respond _] (respond nil))))
|
||||
default-queue (->> [default-handler]
|
||||
|
|
|
|||
|
|
@ -67,14 +67,12 @@
|
|||
|
||||
(defn router
|
||||
"Creates a [[reitit.core/Router]] from raw route data and optionally an options map with
|
||||
support for http-methods and Middleware. See [docs](https://metosin.github.io/reitit/)
|
||||
for details.
|
||||
support for http-methods and Middleware. See documentation on [[reitit.core/router]] for
|
||||
available options. In addition, the following options are available:
|
||||
|
||||
Options:
|
||||
|
||||
| key | description |
|
||||
| ---------------------------------------|-------------|
|
||||
| `:reitit.middleware/transform` | Function of `[Middleware] => [Middleware]` to transform the expanded Middleware (default: identity).
|
||||
| key | description
|
||||
| ---------------------------------------|-------------
|
||||
| `:reitit.middleware/transform` | Function or vector of functions of type `[Middleware] => [Middleware]` to transform the expanded Middleware (default: identity)
|
||||
| `:reitit.middleware/registry` | Map of `keyword => IntoMiddleware` to replace keyword references into Middleware
|
||||
| `:reitit.ring/default-options-handler` | Default handler for `:options` method in endpoints (default: default-options-handler)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue