io.pedestal.http.route.prefix-tree

add-satisfies-constraints?

(add-satisfies-constraints? {:keys [query-constraints path-constraints], :as route})

Given a route, add a function of the request which returns true if the request satisfies all path and query constraints.

contains-wilds?

(contains-wilds? path-spec)

Return true if the given path-spec contains any wildcard params or catch-alls.

create-payload-fn

(create-payload-fn routes)

Given a sequence of routes, return a function of a request which will return a matching route. When the returned function is called we already know that the path matches. The function only considers method, host, scheme and port and will return the most specific match.

insert

(insert node path-spec o)

Given a tree node, a path-spec and a payload object, return a new tree with payload inserted.

lookup

(lookup node path)

Given a tree node and request path, find a matching leaf node and return the path params and payload or return nil if no match is found. Returns a map with :path-params and :payload keys.

partition-wilds

(partition-wilds path-spec)

Given a path-spec string, return a seq of strings with wildcards and catch-alls separated into their own strings. Eats the forward slash following a wildcard.

router

(router routes)

Given a sequence of routes, return a router which satisfies the io.pedestal.http.route.router/Router protocol.