Route#
fitoria supports static path, parameterized path and wildcard matching. The path is configured through the template parameter in order to perform compile-time validation.
route::get<"/api/v1/users/">(handler) // static
route::get<"/api/v1/users/{user}">(handler) // parameterized
route::get<"/api/v1/#wildcard">(handler) // wildcard
route::get<"/api/v1/{">(handler) // error: static_assert failed: 'invalid path for route'
route::get<"/api/v1/}">(handler) // error: static_assert failed: 'invalid path for route'
route::get<"/api/v1/users/{user}x">(handler) // error: static_assert failed: 'invalid path for route'
Path Matching Priority#
Type |
Priority |
Example |
Format |
---|---|---|---|
Static |
1 |
|
|
Parameterized |
2 |
|
A name parameter enclosed within |
Wildcard |
3 |
|
A name parameter follow by |