sibiro.extras

Clojure extras for sibiro.

make-handler

(make-handler routes)
Returns a request handler that is the combination of
`route-handler` with `wrap-try-alts` and `wrap-routes` applied to
it. Routes argument can be compiled or uncompiled.

route-handler

(route-handler request)
A handler that calls the :route-handler of a request that went
through `wrap-routes`.

wrap-routes

(wrap-routes handler routes)
Wrap a handler with middleware that merges the result of
`match-uri` using the given routes on the incoming request. Routes
argument can be compiled or uncompiled. If request already contains
a `:route-handler` key, matching is skipped, and the request is
passed to the wrapped handler unchanged.

wrap-try-alts

(wrap-try-alts handler)
Wraps the handler by merging in each entry from the `:alternatives`
in the request one by one, until a non-nil response is given from
the handler. The first time the request is passed as is.