-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
39 lines (29 loc) · 878 Bytes
/
app.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
39
let config = require("./config/config");
let express = require("express");
let Logger = require("./loaders/logger")("app");
let loaders = require("./loaders");
const cronService = require("./services/cron/index");
async function startServer() {
const app = express();
/**
* A little hack here
* Import/Export can only be used in 'top-level code'
* Well, at least in node 10 without babel and at the time of writing
* So we are using good old require.
**/
await loaders(app);
app.listen(config.port, (err) => {
if (err) {
Logger.error(err);
process.exit(1);
return;
}
Logger.info(`
################################################
🛡️ Server listening on port: ${config.port} 🛡️
################################################
`);
cronService.init();
});
}
startServer();