Page Contents

Home > @loopback/core > Application > onStart

Application.onStart() method

Register a function to be called when the application starts.

This is a shortcut for adding a binding for a LifeCycleObserver implementing a start() method.

Signature:

onStart(fn: () => ValueOrPromise<void>): Binding<LifeCycleObserver>;

Parameters

Parameter Type Description
fn () => ValueOrPromise<void> The function to invoke, it can be synchronous (returning void) or asynchronous (returning Promise<void>).

Returns:

Binding<LifeCycleObserver>

The LifeCycleObserver binding created.