(require '[yada.yada :refer [path-for]])
(path-for ctx :resources/user-profile)
When given the HTTP request, the handler first creates a request-context and populates it with various values, such as the request and the resource-model that corresponds to the request’s URI.
The handler then threads the request-context through a chain of functions, called the interceptor-chain. This 'chain' is just a list of functions specified in the resource-model that has been carefully crafted to generate a response that complies fully with HTTP standards. However, as with anything in the resource-model, you can choose to modify it to your exact requirements if necessary.
The functions making up the interceptor-chain are not necessarily executed in a single thread but rather an asynchronous event-driven implementation enabled by a third-party library called manifold.
Rather than hardcode URLs, you can create the correctly URL with yada’s path-for
function.
(require '[yada.yada :refer [path-for]])
(path-for ctx :resources/user-profile)
An example with a parameter:
(path-for ctx :resources/user-profile
{:route-params {:user-id "42"}})
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close