-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
31 lines (25 loc) · 801 Bytes
/
server.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
require("dotenv").config();
const app = require("./src/app.js");
const scheduledFunctions = require("./scheduledFunctions");
const dbo = require('./src/config/db_config');
var cors = require('cors');
app.use(require('./src/routes/app/encounters'));
app.use(require('./src/routes/app/reports'));
app.use(require('./src/routes/app/playersRankings'));
dbo.connectToServer(function (err) {
if (err) {
console.error(err);
process.exit();
}
app.listen(process.env.PORT || 8085, function () {
console.log(
"Express server listening on port %d in %s mode",
this.address().port,
app.settings.env
);
});
});
//CORS middleware
app.use(cors());
// Call to execute scheduled function(s)
scheduledFunctions.initScheduledJobs();