code: function(app) {
  
    try {
      // make sure we close down within N seconds
      const killtimer = setTimeout(() => {
        process.exit(1);
      }, 3000);
      // But don't keep the process open just for that!
      killtimer.unref();
  
      // stop taking new requests.
      app.server.close();
  
    } catch (err) {
      // oh well, not much we can do at this point.
      console.error('Error shutting down gracefully!', err.stack);
    }
  }
docs: https://nodejs.org/api/domain.html