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