API for noir.server
- ()
Usage:
(ns your-namespace
(:require noir.server))
Overview
A collection of functions to handle Noir's server and add middleware to the stack.
Public Variables and Functions
add-middleware
function
Usage: (add-middleware & args)
Add a middleware function to the noir server. Func is a standard ring middleware
function, which will be passed the handler. Any extra args to be applied should be
supplied along with the function.
gen-handler
function
Usage: (gen-handler & [opts])
Get a full Noir request handler for use with plugins like lein-ring or lein-beanstalk.
If used in a definition, this must come after views have been loaded to ensure that the
routes have already been added to the route table.
load-views
function
Usage: (load-views & dirs)
Require all the namespaces in the given dir so that the pages are loaded
by the server.
load-views-ns
function
Usage: (load-views-ns & ns-syms)
Require all the namespaces prefixed by the namespace symbol given so that the pages
are loaded by the server.
restart
function
Usage: (restart server)
Restart a noir server
start
function
Usage: (start port & [opts])
Create a noir server bound to the specified port with a map of options and return it.
The available options are:
:mode - either :dev or :prod
:ns - the root namepace of your project
:jetty-options - any extra options you want to send to jetty like :ssl?
:base-url - the root url to prepend to generated links and resources
:resource-root - an alternative name for the public folder
:session-store - an alternate store for session handling
:cookie-attrs - custom session cookie attributes
stop
function
Usage: (stop server)
Stop a noir server
noir.server.handler
Handler generation functions used by noir.server and other ring handler libraries.
add-custom-middleware
function
Usage: (add-custom-middleware func & args)
Add a middleware function to all noir handlers.
base-handler
function
Usage: (base-handler & [opts])
Get the most basic Noir request handler, only adding wrap-custom-middleware and wrap-request-map.
wrap-noir-middleware
function
Usage: (wrap-noir-middleware handler opts)
Wrap a base handler in all of noir's middleware