- app-handler
(app
handler-body)
- handler-body
- (?=
:keyword
)
modern-handler-body
; if the body starts by a keyword, it's a "modern" body
- (?!
:keyword
)
legacy-handler-body
; if the body starts by anything else than a keyword it's a "legacy" body
- modern-handler-body
- app-entry*
- app-entry
:middlewares
[
middleware*]
:params
{params destructuring-map}
:params
[
symbol
* ]
; equivalent to {:keys [symbols...]}
- method-dispatch-entry
- route-entry ; note that in a "modern" body, the route order is irrelevant: no more cascading
:handler
clojure-code
; clojure expression evaluating to a handler
:response
clojure-code
; clojure expression evaluating to a response map
- middleware
a-symbol
; must evaluate to a function taking a handler and returning a handler
(some clojure code)
; (some XXX clojure code) must evaluate to a handler — where XXX is the handler to wrap
- route-entry
- route shorthand-or-handler ; route-based dispatch
- route
[
segment* (&
tail-binding?)?]
- segment
"a-string"
#"a-pattern"
a-symbol
; when the route matches, is locally bound to the matching segment
[a-symbol-or-destructuring-form
validator]
- validator
"a-string"
; shorthand for #{"a-string"}
#"a-pattern"
; shorthand for #(re-matches #"a-pattern" %)
a-symbol
; must evaluate to a function
(some clojure code)
; must evaluate to a function
- tail-binding
a-symbol
[a destructuring & form]
- method-dispatch
- method-dispatch-entry+
- method-dispatch-entry
:http-method-keyword
shorthand-or-handler ; method-based dispatch, :http-method-keyword are lowercase and can also be :any
- shorthand-or-handler
{
modern-handler-body}
[
handler-body]
"a-string"
a-symbol
; must evaluate to a handler
(some clojure code)
; must evaluate to a handler
; rules below are not deprecated (not yet) but clearly not the way forward
- legacy-handler-body
- middleware*
{params destructuring-map}
? handler-main ; the destructuring map acts against :params -- when no :params key to be found, try to parse params from url or body (url-encoded form), the resulting map is keyed by keywords, not by strings.
- handler-main
- route-entry+
- method-dispatch
{a-literal ring-response-map}
"a-string"
clojure-expr* ; send a response whose body is (str "a-string" ...)
a-symbol
; must evaluate to a handler
(some clojure code)
; must evaluate to a handler