Attempting to handle async properly under this new wrapping strategy in the hope that makes both async and normal functions act consistently
All checks were successful
Publish to Private NPM Registry / publish (push) Successful in 43s

This commit is contained in:
Alan Bridgeman 2025-06-24 11:12:42 -05:00
parent 56f5cc2cff
commit 0305f5eaeb

View file

@ -78,12 +78,12 @@ export function Controller<T extends { new (...args: any[]): BaseController }>()
const path = Reflect.getMetadata(GET_METADATA_KEY, target.prototype, method); const path = Reflect.getMetadata(GET_METADATA_KEY, target.prototype, method);
// Bind the method to the class instance // Bind the method to the class instance
app.get(path, (req, res, next) => { app.get(path, async (req, res, next) => {
console.log('[Controller.setup.<GET request>] Request:', req); console.log('[Controller.setup.<GET request>] Request:', req);
console.log('[Controller.setup.<GET request>] Response:', res); console.log('[Controller.setup.<GET request>] Response:', res);
console.log('[Controller.setup.<GET request>] Next:', next); console.log('[Controller.setup.<GET request>] Next:', next);
return fn.bind(controller)(req, res, next); return await fn.bind(controller)(req, res, next);
}); });
}); });