ronda.routing.descriptor

assoc-metadata

added in 0.2.0

(assoc-metadata descriptor route-id k v)
Assoc a key/value pair into the given routes metadata.

match-request

(match-request descriptor {:keys [request-method uri]})
Match request against descriptor

merge-metadata

added in 0.2.0

(merge-metadata descriptor route-id m)
Merge the given map into the given routes metadata.

PrefixableRouteDescriptor

protocol

Protocol for RouteDescriptors that can be prefixed with either constant
strings or an additional route parameter.

members

prefix-route-param

(prefix-route-param _ route-param pattern)
Return a new RouteDescriptor representing all routes prefixed with
a string matching the given pattern (if non-nil). When matching a URI
against the new descriptor, the value of said string will be bound to
the given key in `:route-params`.

prefix-string

(prefix-string _ prefix)
Return a new RouteDescriptor representing all routes prefixed with
the given constant string.

RouteDescriptor

protocol

Protocol for Route Descriptors.

members

generate

(generate _ route-id values)
Generate path for the given route ID and params (or `nil` if
the route ID is unknown), returns a map of `:path`, `:route-params`
(the values used as route params) and `:query-params`, as well as any
additional `:meta` data that was attached using `update-metadata`.
Might throw an exception if the values do not match an expected schema.

match

(match _ request-method uri)
Match the given URI, return a map of `:id` (the route ID) and
`:route-params`, as well as any additional `:meta` data that
was attached using `update-metadata`.

routes

(routes _)
Return a map associating route IDs with a map of `:path` (the full
path to the endpoint using bidi's route format) and `:methods`
(the set of request methods applicable for the endpoint), as well as
all the additional `:meta` data set using `update-metadata`.

update-metadata

(update-metadata _ route-id f)
Return a new RouteDescriptor that applies the given function to the given
route's metadata.