Files
main.tsmain
What you'll learn
- Implement OnModuleInit and OnApplicationBootstrap and place each hook in the boot sequence
- Explain why hooks of one module run together, and why work that needs another provider ready belongs in onApplicationBootstrap
- Describe the shutdown hooks, what enables them, and why a browser run never reaches them
Press Run tests to start the app. Its log appears here.Graded endpoints
Within CatsModule, Database's hook finished before CatsService's began, because CatsService depends on it; the root module initialised after the module it imports; every bootstrap hook ran after every init hook
The seed ran in onApplicationBootstrap, after every module had initialised: an onModuleInit seed would have come before app:init
The running application is the same one the hooks prepared