NestJS · Senior · Question 55 of 75
Why do lifecycle hooks not run for request-scoped or transient providers in the usual way?
- ✓Correct answer: They're created per request or per injection, not during app bootstrap, so module init and shutdown hooks don't apply to them
- 2Nest forbids lifecycle hooks in all providers
- 3Hooks run twice for them
Explanation
Put initialization that must run once into singleton providers.