Open
Description
When stopping the server using Ctrl + C, the port (3000) remains occupied, causing the error:
Error: listen EADDRINUSE: address already in use :::3000
This requires manually killing the process before restarting the server, which is inconvenient.
Solution:
Modify server.js to handle the SIGINT signal and close the server properly:
process.on('SIGINT', () => { console.log('\nShutting down server...'); server.close(() => { console.log('Server stopped.'); process.exit(0); }); });
Metadata
Metadata
Assignees
Labels
No labels