NestJS · Senior · Question 54 of 75
What's the difference between onModuleInit and onApplicationBootstrap?
- 1
onApplicationBootstrapruns on every request - ✓Correct answer:
onModuleInitruns when a module's providers are ready;onApplicationBootstrapruns after all modules are initialized, before the app starts listening - 3They are identical
Explanation
Use onApplicationBootstrap for work that needs the whole app, like warming caches that use several modules.