(create-namespace-handler
handler-ns
&
[{:keys [method-fns] :or {method-fns ns-method-fns} :as opts}])
Creates a multi-method request handler based on the given namespace. Uses function name conventions to determine which HTTP methods are supported.
Invokes the relevant function when request is processed. Responds with HTTP Bad Method if request method doesn't have a matching function in the namespace.
May optionally specify the supported request methods and the function names that map to them. May optionally specify the response body for the Bad Method response, which defaults to an empty body.
Creates a multi-method request handler based on the given namespace. Uses function name conventions to determine which HTTP methods are supported. Invokes the relevant function when request is processed. Responds with HTTP Bad Method if request method doesn't have a matching function in the namespace. May optionally specify the supported request methods and the function names that map to them. May optionally specify the response body for the Bad Method response, which defaults to an empty body.
(create-request-method-handler method-fns
&
[{:keys [methods method-not-allowed-body]
:or {methods (-> ns-method-fns keys set)}}])
Creates a multi-method request handler based on the given map of request methods to handler functions.
Invokes the relevant function when request is processed. Responds with HTTP Bad Method if request method doesn't have a matching function in the namespace.
May optionally specify the supported set of request methods. May optionally specify the response body for the Bad Method response, which defaults to an empty body.
Creates a multi-method request handler based on the given map of request methods to handler functions. Invokes the relevant function when request is processed. Responds with HTTP Bad Method if request method doesn't have a matching function in the namespace. May optionally specify the supported set of request methods. May optionally specify the response body for the Bad Method response, which defaults to an empty body.
(create-route-regex prefix & route-parts)
Constructs a route regular expression for the given parts of a route. Automatically adds support for URI prefix and trailing slash.
Constructs a route regular expression for the given parts of a route. Automatically adds support for URI prefix and trailing slash.
(method-handler-fn handler-wrapper {:keys [request-method]})
Returns the underlying method function from the request method handler for the given Ring request. nil is returned if no matched function found.
Returns the underlying method function from the request method handler for the given Ring request. nil is returned if no matched function found.
(named-groups pattern)
Returns sequence of named groups in the given pattern
Returns sequence of named groups in the given pattern
(namespace-route-generator & [prefix])
Generates convenience function for combining regex routes with namespace handlers. May optionally provide a prefix for the routes the function generates.
Returns function that takes two arguments: a string or sequence of strings representing the REST resource and any arguments, and a namespace symbol defining the implemented HTTP methods. Function also takes a variable number of middleware functions that are applied to the namespace handler beforehand but after the route is determined.
Generates convenience function for combining regex routes with namespace handlers. May optionally provide a prefix for the routes the function generates. Returns function that takes two arguments: a string or sequence of strings representing the REST resource and any arguments, and a namespace symbol defining the implemented HTTP methods. Function also takes a variable number of middleware functions that are applied to the namespace handler beforehand but after the route is determined.
Default map of request methods to the relevant namespace function. May be rebound to modify the defaults globally or per usage.
Default map of request methods to the relevant namespace function. May be rebound to modify the defaults globally or per usage.
(routes & handlers)
Create a Ring handler by combining several handlers into one.
Create a Ring handler by combining several handlers into one.
(routing request & handlers)
Apply a list of routes to a Ring request map.
Apply a list of routes to a Ring request map.
(threading-fn value & fns)
Function version of the threading -> macro that applies the variable sequence of functions consecutively on the given initial value
Function version of the threading -> macro that applies the variable sequence of functions consecutively on the given initial value
(uri-regex-route uri-regex handler)
Creates a route handler that dispatches based on the given URI regex. Any groups are injected into the handler's request.
Creates a route handler that dispatches based on the given URI regex. Any groups are injected into the handler's request.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close