const express = require('express');

module.exports = init => {
  const app = express();
  app.disable('x-powered-by');

  init(app, express);

  const port = process.env.PORT;
  if (!port) {
    throw new Error('missing port');
  }
  app.listen(port, () => {
    console.log(`app listen on port ${port}`);
  });
};

const express = require('express');

module.exports = async init => {
  const app = express();
  app.disable('x-powered-by');

  await init(app, express);

  const port = process.env.PORT;
  if (!port) {
    throw new Error('missing port');
  }
  app.listen(port, () => {
    console.log(`app listen on port ${port}`);
  });
};

Allow the init function to be async
Allow the init function to be async
