Function controllerProviderCreator

Generates a configurable controller provider for the application to mount. This is a mix of a controller creator and a controller provider: it gives you the flexibility of the creator, with the resources of the provider.

  class MyController {}
const myControllerProvider = controllerProviderCreator(
({ serviceName = 'myController' }) =>
(app) => {
app.set(serviceName, () => new MyController());
return controller(() => {
const ctrl = app.get<MyController>(serviceName);
const router = app.getRouter();
return router.get('/', ctrl.doSomething());
});
},
);

// ...
container.mount('/charo', myControllerProvider);
  container.mount('/pili', myControllerProvider({ serviceName: 'something' }));