Added SSL certification to all requests
This commit is contained in:
13
server.js
13
server.js
@@ -7,8 +7,16 @@
|
|||||||
var express = require('express'); // call express
|
var express = require('express'); // call express
|
||||||
var app = express(); // define our app using express
|
var app = express(); // define our app using express
|
||||||
var bodyParser = require('body-parser');
|
var bodyParser = require('body-parser');
|
||||||
|
var fs = require('fs');
|
||||||
|
var https = require('https');
|
||||||
var sqlite3 = require('sqlite3').verbose();
|
var sqlite3 = require('sqlite3').verbose();
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
key : fs.readFileSync('server.key'),
|
||||||
|
cert : fs.readFileSync('server.crt')
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// configure app to use bodyParser()
|
// configure app to use bodyParser()
|
||||||
// this will let us get the data from a POST
|
// this will let us get the data from a POST
|
||||||
@@ -53,5 +61,6 @@ app.use('/api', router);
|
|||||||
|
|
||||||
// START THE SERVER
|
// START THE SERVER
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
app.listen(port);
|
https.createServer(options, app).listen(port, function () {
|
||||||
console.log('Magic happens on port ' + port);
|
console.log('Magic happens on port ' + port);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user