createRoute method
HttpRoute
createRoute(
- ServerUniverseMethodType method,
- String path,
- FutureOr callback(
- HttpRequest req,
- HttpResponse res
- List<
FutureOr Function(HttpRequest req, HttpResponse res)> middleware = const [],
Implementation
HttpRoute createRoute(
ServerUniverseMethodType method,
String path,
FutureOr Function(HttpRequest req, HttpResponse res) callback, [
List<FutureOr Function(HttpRequest req, HttpResponse res)> middleware = const [],
]) {
final route = HttpRoute('${pathPrefix == '' ? '' : '${pathPrefix}/'}$path', callback, method, middleware: middleware);
addRoute(route);
return route;
}