addRoute method
APIModule
addRoute(
- APIRequestMethod? method,
- String name,
- APIRouteFunction function, {
- Map<
String, TypeInfo> ? parameters, - Iterable<
APIRouteRule> ? rules, - APIRouteConfig? config,
Adds a route, of name, to this module.
method The route method. If null accepts any method.
function The route handler, to process calls.
Implementation
APIModule addRoute(
APIRequestMethod? method,
String name,
APIRouteFunction function, {
Map<String, TypeInfo>? parameters,
Iterable<APIRouteRule>? rules,
APIRouteConfig? config,
}) {
_checkMethodNotOPTIONS(method);
var routeHandler = APIRouteHandlerFunction(
this,
method,
name,
function,
parameters,
rules,
config,
);
var routesHandlers = _getRoutesHandlers(method);
routesHandlers[name] = routeHandler;
return this;
}