Page Contents
Home > @loopback/core > Application > onInit
Application.onInit() method
Register a function to be called when the application initializes.
This is a shortcut for adding a binding for a LifeCycleObserver implementing a init() method.
Signature:
onInit(fn: () => ValueOrPromise<void>): Binding<LifeCycleObserver>;
Parameters
| Parameter | Type | Description |
|---|---|---|
|
fn |
() => ValueOrPromise<void> |
The function to invoke, it can be synchronous (returning |
Returns:
The LifeCycleObserver binding created.