From 0305f5eaeb8ba3004f7fd95f4a23af56c9777847 Mon Sep 17 00:00:00 2001 From: Alan Bridgeman Date: Tue, 24 Jun 2025 11:12:42 -0500 Subject: [PATCH] Attempting to handle async properly under this new wrapping strategy in the hope that makes both async and normal functions act consistently --- src/decorators/Controller.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/decorators/Controller.ts b/src/decorators/Controller.ts index d17606a..60e02b1 100644 --- a/src/decorators/Controller.ts +++ b/src/decorators/Controller.ts @@ -78,12 +78,12 @@ export function Controller() const path = Reflect.getMetadata(GET_METADATA_KEY, target.prototype, method); // Bind the method to the class instance - app.get(path, (req, res, next) => { + app.get(path, async (req, res, next) => { console.log('[Controller.setup.] Request:', req); console.log('[Controller.setup.] Response:', res); console.log('[Controller.setup.] Next:', next); - return fn.bind(controller)(req, res, next); + return await fn.bind(controller)(req, res, next); }); });