registerRoute abstract method
SimApiBase
registerRoute(
- String route, {
- SimApiHttpMethod? method,
- bool? haveRouteParameters,
- bool? haveQueryParameters,
- RouteHandler? handler,
Registers a route with optional configuration for handling requests.
- route: The API route to register.
- method: Optional. The HTTP method to associate with the route (e.g., GET, POST, PUT, DELETE). If not provided, a default method will be used.
- haveRouteParameters: Optional. Indicates if the route includes dynamic route parameters (e.g.,
/items/{id}). Defaults tofalse. - haveQueryParameters: Optional. Indicates if the route includes query parameters. Defaults to
false. - handler: Optional. A function to handle requests to this route, allowing customization of the response based on request data and query parameters.
This method allows for detailed configuration of a route, including HTTP method, route parameters, and custom request handling.
Implementation
SimApiBase registerRoute(
String route, {
SimApiHttpMethod? method,
bool? haveRouteParameters,
bool? haveQueryParameters,
RouteHandler? handler,
});