Liking cljdoc? Tell your friends :D

noir.core

Functions to work with partials and pages.

Functions to work with partials and pages.
raw docstring

compojure-routeclj

(compojure-route compojure-func)

Adds a compojure route fn to the end of the route table. These routes are queried after those created by defpage and before the generic catch-all and resources routes.

These are primarily used to integrate generated routes from other libs into Noir.

Adds a compojure route fn to the end of the route table. These routes are queried after
those created by defpage and before the generic catch-all and resources routes.

These are primarily used to integrate generated routes from other libs into Noir.
sourceraw docstring

custom-handlercljmacro

(custom-handler & args)

Adds a handler to the end of the route table. This is equivalent to writing a compojure route using noir's [:method route] syntax.

(custom-handler [:post "/login"] {:as req} (println "hello " req)) => (POST "/login" {:as req} (println "hello" req))

These are primarily used to interface with other handler generating libraries, i.e. async aleph handlers.

Adds a handler to the end of the route table. This is equivalent to writing
a compojure route using noir's [:method route] syntax.

(custom-handler [:post "/login"] {:as req} (println "hello " req))
=> (POST "/login" {:as req} (println "hello" req))

These are primarily used to interface with other handler generating libraries, i.e. async aleph handlers.
sourceraw docstring

defpagecljmacro

(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.
sourceraw docstring

defpartialcljmacro

(defpartial fname params & body)

Create a function that returns html using hiccup. The function is callable with the given name.

Create a function that returns html using hiccup. The function is callable with the given name.
sourceraw docstring

noir-routesclj

source

post-routecljmacro

(post-route & args)

Adds a route to the end of the route table and passes the entire request to be desctructured and used in the body. These routes are guaranteed to be evaluated after those created by defpage and before the generic catch-all and resources routes.

Adds a route to the end of the route table and passes the entire request to
be desctructured and used in the body. These routes are guaranteed to be
evaluated after those created by defpage and before the generic catch-all and
resources routes.
sourceraw docstring

post-routesclj

source

pre-routecljmacro

(pre-route & args)

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')))

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')))
sourceraw docstring

pre-routesclj

source

renderclj

(render route & [params])

Renders the content for a route by calling the page like a function with the given param map. Accepts either '/vals' or [:post '/vals']

Renders the content for a route by calling the page like a function
with the given param map. Accepts either '/vals' or [:post '/vals']
sourceraw docstring

route-funcsclj

source

url-forcljmacro

(url-for route & [arg-map])

given a named route, i.e. (defpage foo "/foo/:id"), returns the url for the route. If the route takes arguments, the second argument must be a map of route arguments to values

(url-for foo {:id 3}) => "/foo/3"

given a named route, i.e. (defpage foo "/foo/:id"), returns the url for the
route. If the route takes arguments, the second argument must be a
map of route arguments to values

(url-for foo {:id 3}) => "/foo/3" 
sourceraw docstring

url-for*clj

(url-for* url route-args)
source

url-for-fn*clj

(url-for-fn* route-fn route-args)
source

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

× close