Refers to the type of bundle configuration. See BundleConfigType.
In this method, you can 'wire' the services that your bundle provides.
Bundle configuration overrides.
// Let's say that this bundle provides a `Database` and `DTO` class.
configure(overrides: Partial<MyBundleConfig>): void {
// Merge bundle configuration with the given defaults and overrides
const config = {...new MyBundleConfig(), ...overrides}
// Get some container parameter (could also be passed via config)
const db_uri = container.getParameter('db_uri');
// Wire the services in this bundle
container.transient(LoggerService, [config.logLevel]);
container.singleton(Database, [db_uri, LoggerService]);
container.singleton(SomeDTO, [Database]);
// Register 'self'
container.register(MyBundle, [Database, SomeDTO]);
}
Generated using TypeDoc
Interface for extension bundles.
You may use this system to quickly register a set of services that belong together.
You can also use this to add 'feature toggles' for your application. E.g. only load some bundles in some specific configuration.
Example