mirror of
https://github.com/metosin/reitit.git
synced 2026-02-08 12:53:12 +00:00
Documenting Ring + 404 (Fixes #43)
This commit is contained in:
parent
35aa09b6a3
commit
7cb66ec413
1 changed files with 18 additions and 0 deletions
|
|
@ -112,6 +112,24 @@ Middleware is applied correctly:
|
||||||
; {:status 200, :body [:api :admin :db :delete :handler]}
|
; {:status 200, :body [:api :admin :db :delete :handler]}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Not found
|
||||||
|
|
||||||
|
If no routes match, `nil` is returned, which is not understood by Ring.
|
||||||
|
|
||||||
|
Enabling custom error messages:
|
||||||
|
|
||||||
|
```clj
|
||||||
|
(def app
|
||||||
|
(some-fn
|
||||||
|
(ring/ring-handler
|
||||||
|
(ring/router
|
||||||
|
["/ping" handler]))
|
||||||
|
(constantly {:status 404})))
|
||||||
|
|
||||||
|
(app {:uri "/invalid"})
|
||||||
|
; {:status 404}
|
||||||
|
```
|
||||||
|
|
||||||
# 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