feat(api): enable graceful shutdown hooks

Add NestJS shutdown hooks for proper SIGTERM handling, ensuring
database connections and in-flight requests are drained cleanly.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-08 23:07:39 +07:00
parent 5114f5b87e
commit fedb3f3770

View File

@@ -103,6 +103,9 @@ async function bootstrap() {
// ── Trust Proxy (for rate limiting behind reverse proxy) ──
expressApp.set('trust proxy', 1);
// ── Graceful Shutdown ──
app.enableShutdownHooks();
const port = process.env['PORT'] ?? 3001;
await app.listen(port);
logger.log(`API running on http://localhost:${port}`, 'Bootstrap');