index.js 449 Bytes
Newer Older
Natthaphong Malaphan's avatar
Natthaphong Malaphan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// config should be imported before importing any other file
const config = require('./config/config');
const app = require('./config/express');
require('./config/mongoose');

// module.parent check is required to support mocha watch
// src: https://github.com/mochajs/mocha/issues/1912
if (!module.parent) {
  app.listen(config.port, () => {
    console.info(`server started on port ${config.port} (${config.env})`);
  });
}

module.exports = app;