mirror of
https://github.com/metosin/reitit.git
synced 2025-12-18 00:41:12 +00:00
add docs
This commit is contained in:
parent
158695d47b
commit
0de842585f
1 changed files with 15 additions and 0 deletions
|
|
@ -127,6 +127,21 @@ Middleware is applied correctly:
|
||||||
; {:status 200, :body [:api :admin :db :delete :handler]}
|
; {:status 200, :body [:api :admin :db :delete :handler]}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Top-level middleware, applied before any routing is done:
|
||||||
|
|
||||||
|
```clj
|
||||||
|
(def app
|
||||||
|
(ring/ring-handler
|
||||||
|
(ring/router
|
||||||
|
["/api" {:middleware [[mw :api]]}
|
||||||
|
["/get" {:get handler}]])
|
||||||
|
nil
|
||||||
|
{:middleware [[mw :top]]}))
|
||||||
|
|
||||||
|
(app {:request-method :get, :uri "/api/get"})
|
||||||
|
; {:status 200, :body [:top :api :ok]}
|
||||||
|
```
|
||||||
|
|
||||||
# Async Ring
|
# Async Ring
|
||||||
|
|
||||||
All built-in middleware provide both 2 and 3-arity and are compiled for both Clojure & ClojureScript, so they work with [Async Ring](https://www.booleanknot.com/blog/2016/07/15/asynchronous-ring.html) and [Node.js](https://nodejs.org) too.
|
All built-in middleware provide both 2 and 3-arity and are compiled for both Clojure & ClojureScript, so they work with [Async Ring](https://www.booleanknot.com/blog/2016/07/15/asynchronous-ring.html) and [Node.js](https://nodejs.org) too.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue