route method

NestedRoute route(
  1. String path, {
  2. List<FutureOr Function(HttpRequest req, HttpResponse res)> middleware = const [],
})

Creates one or multiple route segments that can be used as a common base for specifying routes with get, post, etc.

You can define middleware that effects all sub-routes.

Implementation

NestedRoute route(String path,
        {List<FutureOr Function(HttpRequest req, HttpResponse res)>
            middleware = const []}) =>
    NestedRoute(
        alfred: _alfred,
        basePath: _composePath(_basePath, path),
        baseMiddleware: [..._baseMiddleware, ...middleware]);