Node JS ctrl + C doesn’t stop server (after starting server with “npm start”)

Ctrl + C does not kill the server. The resolution to the issue was using following code snippet in server.js:

process.on('SIGINT', function() {
  console.log( "\nGracefully shutting down from SIGINT (Ctrl-C)" );
  // some other closing procedures go here
  process.exit(0);
});

This worked for me.

You can also check for other solutions mentioned at Graceful shutdown in NodeJS

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)