Interface CreateModuleDefinition

Hierarchy

Properties

bootstrap?: Function | ClassType<any>

Module bootstrap class|function. This class is instantiated or function executed on bootstrap and can set up various injected services.

config?: ClassType<any>

Configuration definition.

Example


class MyModuleConfig {
debug: boolean = false;
});

class MyModule extends createModule({
config: MyModuleConfig
});
controllers?: ClassType<any>[]

CLI controllers.

exports?: ExportType[]

Export providers (its token provide value) or modules you imported first.

forRoot?: true

Whether all services should be moved to the root module/application.

imports?: undefined

Modules can not import other modules in the module definitions. Use instead:

class MyModule extends createModule({}) {
imports = [new AnotherModule];
}

or

class MyModule extends createModule({}) {
process() {
this.addModuleImport(new AnotherModule);
}
}

or switch to functional modules

function myModule(module: AppModule) {
module.addModuleImport(new AnotherModule);
}
listeners?: (ClassType<any> | EventListener<any>)[]

Event listeners.

Example

with simple functions

{
listeners: [
onEvent.listen((event: MyEvent) => {console.log('event triggered', event);}),
]
}

Example

with services


class MyListener {
@eventDispatcher.listen(onEvent)
onEvent(event: typeof onEvent['type']) {
console.log('event triggered', event);
}
}

{
listeners: [
MyListener,
]
}
middlewares?: MiddlewareFactory[]

HTTP middlewares.

providers?: ProviderWithScope<any>[]

Providers.

workflows?: WorkflowDefinition<any>[]

Register created workflows. This allows the Framework Debugger to collect debug information and display the graph of your workflow.

Generated using TypeDoc