Skip to content

Instantly share code, notes, and snippets.

@akbarsahata
Created May 2, 2018 10:44
Show Gist options
  • Save akbarsahata/853c614d7044e2849d48f94f2897a3f5 to your computer and use it in GitHub Desktop.
Save akbarsahata/853c614d7044e2849d48f94f2897a3f5 to your computer and use it in GitHub Desktop.
implementation of HTTPS in Node.JS
const https = require('https')
const path = require('path')
const fs = require('fs')
const app = require('../app.js')
const option = {
cert: fs.readFileSync(path.join(__dirname, 'fullchain.pem')),
key: fs.readFileSync(path.join(__dirname, 'privkey.pem')),
}
const server = https.createServer(option, app)
server.listen(443, () => {
console.log('server secure has started')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment