createRoute method

HttpRoute createRoute(
  1. ServerUniverseMethodType method,
  2. String path,
  3. FutureOr callback(
    1. HttpRequest req,
    2. HttpResponse res
    ), [
  4. 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;
}