router
ModuleThe routing table: routes by HTTP method and path template, matched against request paths.
A path /users/:id is stored as the template users/::: with the param
id at segment 1. Matching tries the request's segments with
placeholders substituted at every combination of param positions,
deepest positions first, so a static segment wins over a placeholder at
the leftmost position where two templates differ. A route can be
registered under several methods and alias paths; * templates match a
path prefix; a method-agnostic wildcard catches everything else.
Contents
use utopia_http::Match;pub struct Match<'a, T>A matched route and its path params.
use utopia_http::Router;pub struct Router<T>The routing table: values of type T (an application stores Routes)
by method and path template, each with a stable id.
Default.pub type PathParams = Vec<(String, String)>Path params parsed from a request path, by name.
pub const METHODS: [&str; 5] = ["GET", "POST", "PUT", "PATCH", "DELETE"]The methods a route can be registered under.
pub const PLACEHOLDER: &str = ":::"The segment that stands for a param in a stored template.
pub const WILDCARD: &str = "*"The path segment that matches any path suffix (/assets/*) or, alone,
any path.