Files
vic-server-mongo/index.js
chaosBreaking dc5423d356 init
2019-08-31 14:59:13 +08:00

24 lines
552 B
JavaScript

'use strict';
/**
1.创建数据库连接
2.启动任务队列
3.启动web服务器
*/
const mylog = require('./logger')({ root: 'log', file: 'tic.log' });
global.mylog = mylog;
const runServer = require('./src/server');
const startJob = require('./src/jobs');
const dbConnect = require('./src/common/dbConnect');
const run = tasks => {
[...tasks].reduce((value, func) => {
if (value instanceof Promise) {
return value.then(func);
}
return func(value);
});
};
run([dbConnect, startJob,runServer]);