code: async function setupServer() {
    return new Promise(async (resolve, reject) => {
      config = config || (await getConfig());
      config.components.individual = [];
      config.prod = true;
      config.enableCache = true;
      config.mode = 'server';
      config.env = 'pwa';
      config.sourceMaps = false;
      config.copy = [];
      config.webpackDevServer = false;
      config.buildDir = path.join(config.wwwDir, 'build-ssr');
      config.dataDir = path.join(config.wwwDir, 'build-ssr', 'data');
  
      app.use(express.static(path.relative(process.cwd(), config.wwwDir)));
  
      // generate a fresh webpack build + pass along asset data to dynamic HTML template rendered
      server = await app.listen(port);
  
      app.get('/ssr', function(req, res) {
        res.send(template(html || '', port, webpackStatsGenerated || []));
      });
  
      // handle cleaning up + shutting down the server instance
      process.on('SIGTERM', shutDownSSRServer);
      process.on('SIGINT', shutDownSSRServer);
  
      server.on('connection', connection => {
        connections.push(connection);
        connection.on(
          'close',
          // eslint-disable-next-line no-return-assign
          () => (connections = connections.filter(curr => curr !== connection)),
        );
      });
  
      resolve();
    });
  }
docs: listen for when we need to auto-shut down + track open server connections