Created
April 30, 2018 17:30
-
-
Save ptantiku/370a26c01b41f4f469d2c3945c3f28ce to your computer and use it in GitHub Desktop.
Append code to app.js for enable HTTP or HTTPS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// start the server HTTP & HTTPS | |
const http = require('http'); | |
const https = require('https'); | |
const fs = require('fs'); | |
var credentials = { | |
key: fs.readFileSync('./ssl-cert.key'), | |
cert: fs.readFileSync('./ssl-cert.cert') | |
}; | |
// use HTTP | |
// http.createServer(app).listen(80); | |
// use HTTPS | |
https.createServer(credentials , app).listen(443); | |
console.log("Express is running ..."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment