Skip to content

Commit

Permalink
docs(fundamentals): clarify triggering behavior of init phases
Browse files Browse the repository at this point in the history
  • Loading branch information
micalevisk authored Oct 27, 2024
1 parent b4eac20 commit 61fb0a4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions content/fundamentals/lifecycle-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The following diagram depicts the sequence of key application lifecycle events,

Lifecycle events happen during application bootstrapping and shutdown. Nest calls registered lifecycle hook methods on modules, providers and controllers at each of the following lifecycle events (**shutdown hooks** need to be enabled first, as described [below](https://docs.nestjs.com/fundamentals/lifecycle-events#application-shutdown)). As shown in the diagram above, Nest also calls the appropriate underlying methods to begin listening for connections, and to stop listening for connections.

In the following table, `onModuleInit` and `onApplicationBootstrap` are only triggered if you explicitly call `app.init()` or `app.listen()`.

In the following table, `onModuleDestroy`, `beforeApplicationShutdown` and `onApplicationShutdown` are only triggered if you explicitly call `app.close()` or if the process receives a special system signal (such as SIGTERM) and you have correctly called `enableShutdownHooks` at application bootstrap (see below **Application shutdown** part).

| Lifecycle hook method | Lifecycle event triggering the hook method call |
Expand Down

0 comments on commit 61fb0a4

Please sign in to comment.