Liking cljdoc? Tell your friends :D
All platforms.

ruuter.core


routeclj/s

(route routes {:keys [uri request-method] :as req})

For a given collection of routes and the current HTTP request as req, will attempt to match a route with the HTTP request, which it will then try to return a response for. The only requirement for req is to contain both a uri and request-method key. First should match the request path (like the paths defined in routes) and the second should match the request method used by the HTTP server you pass this fn to.

If no route matched for a given HTTP request it will try to find a route with :not-found as its :path instead, and return the response for that, and if that route was also not found, will return a built-in 404 response instead.

For a given collection of `routes` and the current HTTP request as
`req`, will attempt to match a route with the HTTP request, which it
will then try to return a response for. The only requirement for `req`
is to contain both a `uri` and `request-method` key. First should match
the request path (like the paths defined in routes) and the second
should match the request method used by the HTTP server you pass this fn to.

If no route matched for a given HTTP request it will try to find a
route with `:not-found` as its `:path` instead, and return the response
for that, and if that route was also not found, will return a built-in
404 response instead.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close