async function createServer(options) {
  const {app, storageMethod} = await createApp(options);

  return new Promise((resolve, reject) => {
    const server = createHttpServer(app);

    // Node default socket timeout is 2 minutes.
    // Some LHCI API operations (computing statistics) can take longer than that under heavy load.
    // Set the timeout even higher to allow for these requests to complete.
    server.on('connection', socket => {
      socket.setTimeout(20 * 60 * 1000); // 20 minutes
      socket.on('timeout', () => {
        if (options.logLevel !== 'silent') {
          process.stdout.write(`${new Date().toISOString()} - socket timed out\n`);
        }

        socket.end();
      });
    });

    server.on('error', err => reject(err));

    const listenOptions = {
      port: options.port,
      host: options.host,
    };

    server.listen(listenOptions, () => {
      const serverAddress = server.address();
      const listenPort =
        typeof serverAddress === 'string' || !serverAddress ? options.port : serverAddress.port;

      resolve({
        storageMethod,
        port: listenPort,
        close: async () => {
          await Promise.all([new Promise(r => server.close(r)), storageMethod.close()]);
        },
      });
    });
  });
}
@param {LHCI.ServerCommand.Options} options
@return {Promise<ServerInstance>}