A function that will generate a controller.
const myController = controllerCreator((options = {}) => (app) => {
const router = app.getRouter();
const ctrl = new MyController(options);
return router.get('...', ctrl.doSomething()).post('...', ctrl.doSomethingElse());
});
// ...
container.mount('/charo', myController);
container.mount('/pili', myController({ foo: 'bar' }));
Generated using TypeDoc
Generates a configurable routes controller for the application to mount. It's configurable because the
creator
, instead of just being sent to the container to mount, it can also be called as a function with custom parameters the controller can receive.