-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
40 lines (31 loc) · 903 Bytes
/
index.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
35
36
37
38
39
40
/*
*
* @Date 29 Dec 2018
* @Author: Ameya S. Daddikar
* Description: The entry point for the Hello API Assignment
*/
let http = require('http');
let https = require('https');
let config = require('./config/');
let ajaxServer = require('./src/ajaxServer');
let app = {};
// http server setup
app.httpServer = http.createServer((req, res)=> {
ajaxServer(req, res);
});
// initialize http
app.httpServer.listen(process.env.PORT || 80, () => {
console.log(`HTTP : Listening to port ${process.env.PORT || 80}`);
});
/*
// checks if key and certificate has been set for https
if (typeof(config.httpsOptions) === 'undefined')
return;
//https setup and initialization
app.httpsServer = https.createServer(config.httpsOptions, (req, res) => {
ajaxServer(req, res);
});
app.httpsServer.listen(config.httpsPort, () => {
console.log(`HTTPS : Listening to port ${config.httpsPort}`);
});
*/