Plugin Lifecycle Methods

Plugin Lifecycle Methods

BeforeVendureBootstrap

A plugin which implements a static beforeVendureBootstrap method with this type can define logic to run before the Vendure server (and the underlying Nestjs application) is bootstrapped. This is called after the Nestjs application has been created, but before the app.listen() method is invoked.

Signature

type BeforeVendureBootstrap = (app: INestApplication) => void | Promise<void>

BeforeVendureWorkerBootstrap

A plugin which implements a static beforeVendureWorkerBootstrap method with this type can define logic to run before the Vendure worker (and the underlying Nestjs microservice) is bootstrapped. This is called after the Nestjs microservice has been created, but before the microservice.listen() method is invoked.

Signature

type BeforeVendureWorkerBootstrap = (app: INestMicroservice) => void | Promise<void>

OnVendureBootstrap

A plugin which implements this interface can define logic to run when the Vendure server is initialized.

For example, this could be used to call out to an external API or to set up EventBus listeners.

Signature

interface OnVendureBootstrap {
  onVendureBootstrap(): void | Promise<void>;
}

Members

onVendureBootstrap

method
type:
() => void | Promise<void>

OnVendureWorkerBootstrap

A plugin which implements this interface can define logic to run when the Vendure worker is initialized.

For example, this could be used to start or connect to a server or databased used by the worker.

Signature

interface OnVendureWorkerBootstrap {
  onVendureWorkerBootstrap(): void | Promise<void>;
}

Members

onVendureWorkerBootstrap

method
type:
() => void | Promise<void>

OnVendureClose

A plugin which implements this interface can define logic to run before Vendure server is closed.

For example, this could be used to clean up any processes started by the OnVendureBootstrap method.

Signature

interface OnVendureClose {
  onVendureClose(): void | Promise<void>;
}

Members

onVendureClose

method
type:
() => void | Promise<void>

OnVendureWorkerClose

A plugin which implements this interface can define logic to run before Vendure worker is closed.

For example, this could be used to close any open connections to external services.

Signature

interface OnVendureWorkerClose {
  onVendureWorkerClose(): void | Promise<void>;
}

Members

onVendureWorkerClose

method
type:
() => void | Promise<void>