|
|
@@ -1,9 +1,13 @@
|
|
1
|
1
|
var express = require('express');
|
|
|
2
|
+var https = require('https');
|
|
2
|
3
|
var app = express();
|
|
3
|
4
|
var bcrypt = require('bcrypt-nodejs');
|
|
4
|
5
|
var Redis = require('ioredis');
|
|
5
|
6
|
var redis = new Redis();
|
|
6
|
7
|
var bodyParser = require('body-parser');
|
|
|
8
|
+var fs = require('fs');
|
|
|
9
|
+var p_key = fs.readFileSync( 'server.key' )
|
|
|
10
|
+var certi = fs.readFileSync( 'server.crt' );
|
|
7
|
11
|
|
|
8
|
12
|
app.use(bodyParser.json()); // for parsing application/json
|
|
9
|
13
|
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
|
|
|
@@ -91,8 +95,15 @@ app.all('/login', function(req, res) {
|
|
91
|
95
|
});
|
|
92
|
96
|
});
|
|
93
|
97
|
|
|
94
|
|
-app.listen(3000, function () {
|
|
95
|
|
- console.log('Example app listening on port 3000!');
|
|
|
98
|
+// app.listen(3000, function () {
|
|
|
99
|
+// console.log('Example app listening on port 3000!');
|
|
|
100
|
+// });
|
|
|
101
|
+
|
|
|
102
|
+https.createServer({
|
|
|
103
|
+ key: p_key,
|
|
|
104
|
+ cert: certi
|
|
|
105
|
+}, app).listen(3000, function() {
|
|
|
106
|
+ console.log("App listening for HTTPS connections on port 3000!");
|
|
96
|
107
|
});
|
|
97
|
108
|
|
|
98
|
109
|
process.on('SIGINT', function() {
|