Functions/Macros to work with partials and pages. Extracted from noir source code.
Functions/Macros to work with partials and pages. Extracted from noir source code.
(defpage & args)
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.
There are several supported forms:
(defpage "/foo/:id" {id :id}) an unnamed route (defpage [:post "/foo/:id"] {id :id}) a route that responds to POST (defpage foo "/foo:id" {id :id}) a named route (defpage foo [:post "/foo/:id"] {id :id})
The default method is GET.
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. There are several supported forms: (defpage "/foo/:id" {id :id}) an unnamed route (defpage [:post "/foo/:id"] {id :id}) a route that responds to POST (defpage foo "/foo:id" {id :id}) a named route (defpage foo [:post "/foo/:id"] {id :id}) The default method is GET.
(defpartial fname & args)
Create a function that returns html using hiccup. The function is callable with the given name. Can optionally include a docstring or metadata map, like a normal function declaration.
Create a function that returns html using hiccup. The function is callable with the given name. Can optionally include a docstring or metadata map, like a normal function declaration.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close