mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 16:31:11 +00:00
simplify
This commit is contained in:
parent
d8a8bce272
commit
5a2ae56991
1 changed files with 4 additions and 10 deletions
|
|
@ -153,16 +153,10 @@
|
||||||
(defn routes
|
(defn routes
|
||||||
"Create a ring handler by combining several handlers into one."
|
"Create a ring handler by combining several handlers into one."
|
||||||
{:arglists '([& handlers])}
|
{:arglists '([& handlers])}
|
||||||
([] nil)
|
([& [handler1 handler2 & handlers]]
|
||||||
([handler] handler)
|
(cond (seq handlers) (reduce routes (routes handler1 handler2) handlers)
|
||||||
([handler1 handler2]
|
|
||||||
(cond
|
|
||||||
(and handler1 handler2) (comp-handlers handler1 handler2)
|
(and handler1 handler2) (comp-handlers handler1 handler2)
|
||||||
handler1 handler1
|
:else (or handler1 handler2))))
|
||||||
handler2 handler2
|
|
||||||
:else nil))
|
|
||||||
([handler1 handler2 & handlers]
|
|
||||||
(reduce routes (routes handler1 handler2) handlers)))
|
|
||||||
|
|
||||||
(defn redirect-trailing-slash-handler
|
(defn redirect-trailing-slash-handler
|
||||||
"A ring handler that redirects a missing path if there is an
|
"A ring handler that redirects a missing path if there is an
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue