Generates a middleware for the application container to mount.
const myMiddleware = controller((app) => { const responsesBuilder = app.get<ResponsesBuilder>('responsesBuilder'); return (_, res) => { responsesBuilder.json({ res, data: { hello: 'world' } }); }; }); // ... container.use(myMiddleware); Copy
const myMiddleware = controller((app) => { const responsesBuilder = app.get<ResponsesBuilder>('responsesBuilder'); return (_, res) => { responsesBuilder.json({ res, data: { hello: 'world' } }); }; }); // ... container.use(myMiddleware);
container.mount('/charo', myMiddleware); Copy
container.mount('/charo', myMiddleware);
A function that will be called the moment the application tries to mount the middleware.
Generates a middleware for the application container to mount.
Example: Basic usage
Example: On a specific route