-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (27 loc) · 880 Bytes
/
Copy pathindex.js
File metadata and controls
33 lines (27 loc) · 880 Bytes
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
var http = require("http");
var https = require("https");
var url = require("url");
var StringDecoder = require("string_decoder").StringDecoder;
var config = require("./config");
var fs = require("fs");
var handlers = require("./lib/handlers");
var httpServer = http.createServer(function (req, res) {
unifiedServer(req, res);
});
httpServer.listen(config.httpPort, function () {
console.log("The server is listening on port " + config.httpPort);
});
var httpsServerOptions = {
key: fs.readFileSync("./https/key.pem"),
cert: fs.readFileSync("./https/cert.pem"),
};
var httpsServer = https.createServer(httpsServerOptions, function (req, res) {
unifiedServer(req, res);
});
httpsServer.listen(config.httpsPort, function () {
console.log("The server is listening on port " + config.httpsPort);
});
var router = {
ping: handlers.ping,
users: handlers.users,
};