Created
June 24, 2016 10:59
-
-
Save kamilziajka/7d3ac3dcec7d3da19edda9654bd85973 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem |
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
FROM node:6 | |
ADD server.js /server.js | |
ADD cert.pem /cert.pem | |
ADD key.pem /key.pem | |
CMD ["node", "/server.js"] | |
EXPOSE 8080 |
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 {createServer} = require('https'); | |
const {readFileSync} = require('fs'); | |
const port = 8080; | |
const host = '0.0.0.0'; | |
const options = { | |
key: readFileSync('key.pem'), | |
cert: readFileSync('cert.pem') | |
}; | |
const server = createServer(options, (req, res) => { | |
res.end('hello https'); | |
}); | |
server.listen( | |
port, | |
host, | |
() => console.log('server up') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment