-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
27 lines (22 loc) · 833 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
/** @file This is the main file. It starts the update process of the database and the HTTPS server. */
const express = require('express');
const app = express();
const fs = require('fs');
const https = require('https');
const routes = require('./APIs/routes.js');
const updater = require('./updater/updater.js')
//start the update process of the database
updater.init_db();
const ip = process.env.HOST;
const port = process.env.PORT;
const options = {
cert: fs.readFileSync(process.env.SERVER_CERTIFICATE_PATH),
key: fs.readFileSync(process.env.SERVER_RSA_PRIVATE_KEY_PATH),
requestCert: true,
rejectUnauthorized: false
};
//create an https server with the options from app
var server = https.createServer(options, app).listen(port, ip);
console.log("listening at " + ip + ":" + port);
//Pass app to the routes
routes(app);