fast-twitch.middlewares.defaults
Complete generated reference for fast-twitch.middlewares.defaults
Choose a configuration
(ns application.defaults
(:require [fast-twitch.middlewares.defaults :as defaults]))
(defn handler [_]
{:status 200 :headers {"content-type" "text/plain"} :body "Hello"})
(def app (defaults/wrap-defaults handler defaults/site-defaults))
wrap-defaults takes [handler options]. api-defaults and site-defaults are ordinary option maps, not functions or runtime singletons. The defaults table lists enabled features and execution constraints. The todo project shows custom settings around an authenticated application.
API defaults parse URL-encoded/query parameters and keywordize them; site defaults add multipart/nested parameters, cookies, sessions, flash and anti-forgery. Neither map implies JSON body decoding, durable session storage, active rate limiting or proxy trust. Request-control and deployment/security settings must be explicitly selected. HEAD wrapping is included by the current response-default chain.
Change a nested setting with assoc-in on the selected map, for example (assoc-in defaults/api-defaults [:requests :timeout] {:timeout-ms 5000}). Wrapper-specific options remain wrapper-specific; see the full inventory.
Upstream function reference
Preconfigured middleware bundles for common API and site-oriented applications.
api-defaults
Default middleware options for API-oriented applications. Source
site-defaults
Default middleware options for browser-facing site applications. Source
wrap-defaults
(wrap-defaults handler options)
Function.
Applies the configured default middleware bundles to a handler. Source