From d8a46eeb7b8befde4cf3ebd504839307048e28ab Mon Sep 17 00:00:00 2001 From: Adones Pitogo Date: Sun, 27 Nov 2022 02:40:04 +0800 Subject: [PATCH] Update Middlewares.md --- docs/Middlewares.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/Middlewares.md b/docs/Middlewares.md index b10b484..994ad26 100644 --- a/docs/Middlewares.md +++ b/docs/Middlewares.md @@ -21,9 +21,10 @@ router.use('/api', (request, response, next) => { server.use(async (request, response) => { // You can also just return new Promise((resolve, reject) => {}); instead of async callback try { - await some_async_operation(request, response); + await some_async_operation(); + // The request proceeds to the next middleware/handler after the promise resolves } catch (error) { return error; // This will trigger global error handler as we are returning an Error } }); -``` \ No newline at end of file +```