2020-04-08 03:19:55 +02:00
|
|
|
import "./init"
|
2020-06-30 01:10:18 +02:00
|
|
|
import {config} from "./config"
|
2020-04-08 03:19:55 +02:00
|
|
|
import Logger from "./logger"
|
2020-04-08 22:05:53 +02:00
|
|
|
import * as db from "./db/database"
|
2020-04-08 23:41:04 +02:00
|
|
|
import * as scheduler from "./jobs/scheduler"
|
|
|
|
import * as router from "./router"
|
2020-06-30 01:10:18 +02:00
|
|
|
import * as app from "./app"
|
2020-04-08 03:19:55 +02:00
|
|
|
|
2020-06-30 01:10:18 +02:00
|
|
|
app.init();
|
|
|
|
Logger.init();
|
2020-04-08 03:19:55 +02:00
|
|
|
Logger.tag('main', 'startup').info('Server starting up...');
|
|
|
|
|
2020-06-30 01:10:18 +02:00
|
|
|
async function main() {
|
2020-04-08 03:19:55 +02:00
|
|
|
Logger.tag('main').info('Initializing...');
|
|
|
|
|
2020-06-30 01:10:18 +02:00
|
|
|
await db.init();
|
2020-04-08 03:19:55 +02:00
|
|
|
scheduler.init();
|
2020-06-30 01:10:18 +02:00
|
|
|
|
2020-04-08 23:41:04 +02:00
|
|
|
router.init();
|
2020-04-08 03:19:55 +02:00
|
|
|
|
2020-06-30 01:10:18 +02:00
|
|
|
app.app.listen(config.server.port, '::');
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|
|
|
|
.catch(error => {
|
|
|
|
console.error('Unhandled runtime error:', error);
|
|
|
|
process.exit(1);
|
|
|
|
});
|