API for noir.core
Functions to work with partials and pages.
Public Variables and Functions
Usage: (defpage route destruct & body)
Adds a route to the server whose content is the the result of evaluating the body.
The function created is passed the params of the request and the destruct param allows
you to destructure that meaningfully for use in the body. Routes can either be a string
or a vector of [method route], such as [:post '/vals']. The default method is GET.
Usage: (defpartial fname params & body)
Create a function that returns html using hiccup. The function is callable with the given name.
Usage: (pre-route route destruct & body)
Adds a route to the beginning of the route table and passes the entire request
to be destructured and used in the body. These routes are the only ones to make
an ordering gaurantee. They will always be in order of ascending specificity (e.g. /* ,
/admin/* , /admin/user/*) Pre-routes are usually used for filtering, like redirecting
a section based on privileges:
(pre-route '/admin/*' (when-not (is-admin?) (redirect '/login')))
Usage: (render route & [params])
Renders the content for a route by calling the page like a function
with the given param map. Just like with defpage, route can be a vector,
e.g. [:post '/vals']