code: function gracefulShutdown(){
    console.log('About to exit, closing servers.');
  
    servers.forEach(function(server, index){
      server.close();
    });
  
    process.exit();
  }
docs: Regular Exit process.on('exit', gracefulShutdown);