-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
34 lines (27 loc) · 784 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
let config = require("./config/config");
let express = require("express");
let Logger = require("./loaders/logger");
let loaders = require("./loaders");
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} 🛡️
################################################
`);
});
}
startServer();