-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
31 lines (23 loc) · 855 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
const http = require("http");
const https = require("https");
const fs = require("fs");
const {Callback} = require(__dirname + "/Callback.js");
const config = require(__dirname + "/config.json");
const https_options = {
key: fs.readFileSync(__dirname + "/" + config.cert.key),
cert: fs.readFileSync(__dirname + "/" + config.cert.cert)
};
// Set process name
process.title = "Web Cache Controller";
const callback = new Callback();
// Start https Server
const webServerHttps = https.createServer(https_options, app).listen(config.httpsPort, function() {
console.log("HTTPS server on Port " + config.httpsPort);
});
// Start http Server
const webServer = http.createServer(app).listen(config.httpPort, function() {
console.log("HTTP server on Port " + config.httpPort);
});
function app(req, res) {
callback.start(req, res);
};