Functions for creating routes for ring applications.
Functions for creating routes for ring applications.
(ANY pattern handler)
Creates a route for a call with any method to pattern
handled by handler
.
See route
for pattern rules.
Creates a route for a call with any method to `pattern` handled by `handler`. See [[route]] for pattern rules.
(CONNECT pattern handler)
Creates a route for a CONNECT call to pattern
handled by handler
.
See route
for pattern rules.
Creates a route for a CONNECT call to `pattern` handled by `handler`. See [[route]] for pattern rules.
(DELETE pattern handler)
Creates a route for a DELETE call to pattern
handled by handler
.
See route
for pattern rules.
Creates a route for a DELETE call to `pattern` handled by `handler`. See [[route]] for pattern rules.
(GET pattern handler)
Creates a route for a GET call to pattern
handled by handler
.
See route
for pattern rules.
Creates a route for a GET call to `pattern` handled by `handler`. See [[route]] for pattern rules.
(group & routes)
Creates a group that will select among routes
for a match. Returns nil if
no match is found.
Creates a group that will select among `routes` for a match. Returns nil if no match is found.
(HEAD pattern handler)
Creates a route for a HEAD call to pattern
handled by handler
.
See route
for pattern rules.
Creates a route for a HEAD call to `pattern` handled by `handler`. See [[route]] for pattern rules.
(OPTIONS pattern handler)
Creates a route for a OPTIONS call to pattern
handled by handler
.
See route
for pattern rules.
Creates a route for a OPTIONS call to `pattern` handled by `handler`. See [[route]] for pattern rules.
(PATCH pattern handler)
Creates a route for a PATCH call to pattern
handled by handler
.
See route
for pattern rules.
Creates a route for a PATCH call to `pattern` handled by `handler`. See [[route]] for pattern rules.
(POST pattern handler)
Creates a route for a POST call to pattern
handled by handler
.
See route
for pattern rules.
Creates a route for a POST call to `pattern` handled by `handler`. See [[route]] for pattern rules.
(PUT pattern handler)
Creates a route for a PUT call to pattern
handled by handler
.
See route
for pattern rules.
Creates a route for a PUT call to `pattern` handled by `handler`. See [[route]] for pattern rules.
(route method pattern handler)
Creates a route to match method
and pattern
to handler
. Returns a ring
handler that returns the result of handler
if the request matches, and nil
otherwise.
method
should be a keyword that matches an HTTP method, such as :get
. It
may also be :*
to match any method.
pattern
is a string that describes the (potentially partial) URI for the
request. The pattern may contain path parameters identified by keywords, such
as /users/:id
. In this example, :id
is a path parameter. When a match is
found, the route will parse the path parameters into a map attached as
:path-params
to the request.
pattern
may also be a prefix value. If a pattern ends with /
(except the
root route) or ...
, the pattern is treated as a prefix. Here are some
examples. The pattern /api/
matches /api/some/other/path
and the pattern
/images/image-...
matches /images/image-logo.png
but not
images/logo.png
.
handler
is a ring handler to handle the request if the method and pattern
match.
Creates a route to match `method` and `pattern` to `handler`. Returns a ring handler that returns the result of `handler` if the request matches, and nil otherwise. `method` should be a keyword that matches an HTTP method, such as `:get`. It may also be `:*` to match any method. `pattern` is a string that describes the (potentially partial) URI for the request. The pattern may contain path parameters identified by keywords, such as `/users/:id`. In this example, `:id` is a path parameter. When a match is found, the route will parse the path parameters into a map attached as `:path-params` to the request. `pattern` may also be a prefix value. If a pattern ends with `/` (except the root route) or `...`, the pattern is treated as a prefix. Here are some examples. The pattern `/api/` matches `/api/some/other/path` and the pattern `/images/image-...` matches `/images/image-logo.png` but not `images/logo.png`. `handler` is a ring handler to handle the request if the method and pattern match.
(router & routes)
Creates a router that will select among routes
for a match. Returns a 404
Not Found response if no route matches.
Creates a router that will select among `routes` for a match. Returns a 404 Not Found response if no route matches.
(subrouter prefix & routes)
Creates a router at prefix
and applies requests at that prefix to routes
.
Returns nil if no match is found. Parses path parameters from prefix
into
the :path-params
field of the request.
Creates a router at `prefix` and applies requests at that prefix to `routes`. Returns nil if no match is found. Parses path parameters from `prefix` into the `:path-params` field of the request.
(TRACE pattern handler)
Creates a route for a TRACE call to pattern
handled by handler
.
See route
for pattern rules.
Creates a route for a TRACE call to `pattern` handled by `handler`. See [[route]] for pattern rules.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close