Created
December 16, 2019 17:02
-
-
Save ryanlid/5df4ff4938ab2b9714a2eadc3778b765 to your computer and use it in GitHub Desktop.
HTTPS Server by Node.js
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
const https = require('https'); | |
const fs = require('fs') | |
const options = { | |
key: fs.readFileSync('./cert/domain.key'), | |
cert: fs.readFileSync('./cert/domain.pem') | |
} | |
const app = https.createServer(options, (req, res) => { | |
res.writeHead(200, { 'Content-Type': 'text/plain' }) | |
res.end('Hello World!\n') | |
}) | |
app.listen(4000, '0.0.0.0') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment