code: function(retCode) {
          retCode = (typeof retCode !== 'undefined') ? retCode : 0;
  
          if (server) {
              if (shutdownInProgress) { return; }
  
              shutdownInProgress = true;
              console.info('Shutting down gracefully...');
              server.close(function() {
                  console.info('Closed out remaining connections');
                  process.exit(retCode);
              });
  
              setTimeout(function() {
                  console.error('Could not close out connections in time, force shutdown');
                  process.exit(retCode);
              }, 10 * 1000).unref();
  
          } else {
              console.debug('Http server is not running. Exiting');
              process.exit(retCode);
          }
      }
docs: Shut down gracefully