processHandlersWithMiddleware method
Implementation
Future<void> processHandlersWithMiddleware(
Future<Response> Function(Context context) initialHandler,
List<Function> allMiddlewares,
Context context,
HttpRequest request) async {
try {
var handler = initialHandler;
allMiddlewares.forEach((element) async {
handler = element(handler);
});
final response = handler(context);
await writeResponse(request, response);
} catch (err, stacktrace) {
await writeErrorResponse(request, err, stacktrace);
}
}