Middleware takes a context and a next callback to pass the control the next middleware in the stack.
context This is the use case context it contains dependencies and the use case to handle.
next It's the callback to call to pass the control to the next middleware in the stack.
const dependencies: AppDependencies = { logger: console.log };const app = createApp(dependencies);app.use(loggerMiddleware);const commandResult = await app.execute(commands);const queryResult = await app.execute(query);
Your app dependencies like repositories, logger, database connection, etc...
CQRSApp
Generated using TypeDoc
Middleware takes a context and a next callback to pass the control the next middleware in the stack.
context This is the use case context it contains dependencies and the use case to handle.
next It's the callback to call to pass the control to the next middleware in the stack.