Routes
Zeta uses rou3 internally to route requests to the appropriate handler.
To add a path parameter to your endpoint, use the :paramName syntax in the route and add a schema for it in the endpoint's definition:
;
Path parameters are available via the context's params property.
There are three ways to define a path parameter:
:paramName – Named** – Anonymous wildcard**:paramName – Named wildcardWildcard parameters accept any number of path segments, and can be accessed by params["**"] or params.paramName, depending on if it is anonymous or named.
Here's an example using an anonymous wildcard parameter to throw a 404 error if the API endpoint is not found:
"/health", ,
// ...
"/**",;
Refer to rou3's documentation for more details.
Path parameters are strings by default. If you want to transform or convert the parameter into a different type, like a number, use your validation library to coerce the value:
;