forked from sarmatdev/ptah-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (29 loc) · 805 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
const argv = require('argv');
const logger = require('./common/middleware/logger');
const app = require('./app/app');
const billing = require('./billing/billing');
const migrate = require('./common/utils/migrate');
const argvOptions = [
{
name: 'task',
type: 'string'
}
];
(async function main() {
logger.info('~~~ PTAH BACKEND ~~~');
await migrate.start(logger);
const args = argv.option(argvOptions).run();
const task = (args.options.task || '').toLowerCase();
if (task === 'billing') {
logger.info('starting billing');
return await billing.start(logger);
}
logger.info('starting app...');
app.start(logger);
})()
.then()
.catch(err => {
logger.error(err);
process.exit(1);
});