Useful Reitit router middlewares and helpers.
Useful Reitit router middlewares and helpers.
(create-resource-handler-cached
{:keys [cached? cache-control] :or {cached? false} :as opts})
Return resource handler with optional Cache-Control header.
Return resource handler with optional Cache-Control header.
(csrf-token)
Return the CSRF token value.
Return the CSRF token value.
(csrf-token-html)
Return a hidden input field with the CSRF token.
Return a hidden input field with the CSRF token.
(csrf-token-json)
Return a JSON object as string with the CSRF token. Useful for headers in AJAX requests.
Return a JSON object as string with the CSRF token. Useful for headers in AJAX requests.
Common exception middleware to handle all errors.
Common exception middleware to handle all errors.
(get-route router route-name)
(get-route router route-name {:keys [path query]})
Return the API route by its name, with optional path and query parameters.
Return the API route by its name, with optional path and query parameters.
(handler-ssr {:keys [routes default-handlers session-store middlewares]
:or {middlewares []}}
{:keys [options] :as context})
Return main application handler for server-side rendering.
DEPRECATED: Define the server directly in a project instead. Can be used as an example of how to create a handler with Reitit.
Return main application handler for server-side rendering. DEPRECATED: Define the server directly in a project instead. Can be used as an example of how to create a handler with Reitit.
Middleware for validating and coercing request parameters based on route specs.
Expects a :coercion
of type reitit.coercion/Coercion
and :parameters
defined in
route data. If either is missing, the middleware will not mount. Validates request
parameters against specs and coerces them to the correct types. If coercion fails,
does not throw an exception but passes a request with :errors
key containing.
Based on reitit.ring.coercion/coerce-request-middleware
but does not throw exceptions.
Middleware for validating and coercing request parameters based on route specs. Expects a `:coercion` of type `reitit.coercion/Coercion` and `:parameters` defined in route data. If either is missing, the middleware will not mount. Validates request parameters against specs and coerces them to the correct types. If coercion fails, does not throw an exception but passes a request with `:errors` key containing. Based on `reitit.ring.coercion/coerce-request-middleware` but does not throw exceptions.
(render-html content)
Render hiccup content as HTML response.
Render hiccup content as HTML response.
(wrap-context handler context)
Add system dependencies of handler to request as a context key.
Add system dependencies of handler to request as a context key.
(wrap-reload f)
Reload ring handler on every request. Useful in dev mode.
Reload ring handler on every request. Useful in dev mode.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close