NestJS provides lifecycle hooks — methods you implement to run code at specific moments in the application's or a provider's lifecycle (initialization and shutdown). They're essential for setup (connecting to resources) and cleanup (closing connections gracefully).
The main hooks
()
, {
() {
.();
}
() {
.();
}
}
