chore: prettier on server

This commit is contained in:
Katie Thornhill 2019-11-19 23:02:54 -05:00
parent 3b0d249e41
commit 912b40c383
No known key found for this signature in database
GPG key ID: F76EDC6541A99644
21 changed files with 589 additions and 501 deletions

View file

@ -1,22 +1,22 @@
const log = new (require('../logger'))('api/index')
const glob = require('glob')
const log = new (require('../logger'))('api/index');
const glob = require('glob');
const PROD = process.env.NODE_ENV === 'production'
const PROD = process.env.NODE_ENV === 'production';
module.exports = async (router, ctx) => {
const apis = glob.sync(`./api/**/!(index).js`)
log.debug('found apis', apis)
const apis = glob.sync(`./api/**/!(index).js`);
log.debug('found apis', apis);
for (let a of apis) {
if (a.endsWith('_test.js') && PROD) {
log.debug(`skipping ${a}`)
continue
log.debug(`skipping ${a}`);
continue;
}
log.debug(`mounting ${a}`)
log.debug(`mounting ${a}`);
try {
require(a.replace('api/', ''))(router, ctx)
require(a.replace('api/', ''))(router, ctx);
} catch (e) {
log.error(`couldn't mount ${a}`, e)
log.error(`couldn't mount ${a}`, e);
}
}
}
};