Coding task · NestJS course · Module 6: Error Handling and Monitoring

OnModuleDestroy and OnApplicationShutdown Implementation

Implement a service that clears intervals and closes the database connection when the application shuts down

Task

Complete the service implementing OnModuleDestroy and OnApplicationShutdown: in onModuleDestroy() clear the intervals (clearInterval), and in onApplicationShutdown(), when the HTTP server no longer accepts requests, close the database connection (this.connection.close())