routeParam
mach::Request::routeParam
Returns a route parameter.
Description
Section titled “Description”Returns the value of the route parameter with the specified name.
Syntax
Section titled “Syntax”[[nodiscard]] std::string_view routeParam(std::string_view name) const;Return Value
Section titled “Return Value”The route parameter value.
Parameters
Section titled “Parameters”| Parameter | Description |
|---|---|
name |
The name of the route parameter to return. |
Exceptions
Section titled “Exceptions”| Exception | Condition |
|---|---|
std::bad_alloc |
Thrown if memory allocation fails. |
std::out_of_range |
Thrown if the specified parameter does not exist. |
Thread Safety
Section titled “Thread Safety”This function is thread-safe.
Remarks
Section titled “Remarks”Route parameter names are case-sensitive.
Example
Section titled “Example”auto id = request().routeParam("id");See Also
Section titled “See Also”| Name | Description |
|---|---|
routeParam<T> |
Returns a route parameter converted to a specified type. |