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](/doc/en/lb4/apidocs.context.valueorpromise.html)<void> The function to invoke, it can be synchronous (returning `void`) or asynchronous (returning `Promise`). </td></tr> </tbody></table> **Returns:** [Binding](/doc/en/lb4/apidocs.context.binding.html)<[LifeCycleObserver](/doc/en/lb4/apidocs.core.lifecycleobserver.html)> The LifeCycleObserver binding created.