runMiddlewareAndController function

FutureOr runMiddlewareAndController(
  1. DoxRequest doxReq
)

Run middleware and controllers. It stays sync while every step gives a plain value, so a simple route needs no Future. At the first Future it waits, then goes on with the next item.

Implementation

FutureOr<dynamic> runMiddlewareAndController(DoxRequest doxReq) {
  /// a route with a `next` middleware takes the slower async chain.
  /// other routes never pay for it.
  if (doxReq.route.usesNext) return _chain(doxReq, 0);
  return _runFrom(doxReq, 0, null);
}