Complete the code to listen for the shutdown signal.
process.on('[1]', () => { console.log('Shutdown signal received'); });
The SIGINT signal is sent when you press Ctrl+C in the terminal, which is commonly used to trigger graceful shutdown.
Complete the code to close the HTTP server on shutdown.
server.[1](() => { console.log('Server closed'); });
The close method stops the server from accepting new connections and waits for existing connections to finish.
Fix the error in the shutdown handler to exit the process after closing the server.
process.on('SIGTERM', () => { server.close(() => { [1](0); }); });
The process.exit(0) command cleanly exits the Node.js process with a success code.
Fill both blanks to handle multiple shutdown signals and close the server.
['SIGINT', '[1]'].forEach(signal => { process.on(signal, () => { server.[2](() => { console.log(`${signal} received, server closed.`); process.exit(0); }); }); });
SIGTERM is another common shutdown signal. The server's close method stops it gracefully.
Fill all three blanks to log shutdown start, close server, and log shutdown complete.
process.on('SIGINT', () => { console.log('[1]'); server.[2](() => { console.log('[3]'); process.exit(0); }); });
Logging before and after closing the server helps track the shutdown process. The server is closed with close.