HTTPS static file server with connect
This file contains 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
var connect = require('connect'); | |
var serveStatic = require('serve-static'); | |
var https = require('https'); | |
// Get certificates for free here | |
// https://letsencrypt.org/ | |
var key = fs.readFileSync('./key.pem'); | |
var cert = fs.readFileSync('./cert.pem') | |
var options = { | |
key: key, | |
cert: cert | |
}; | |
var port = 443; | |
var folder = __dirname; | |
var app = connect(); | |
app.use(serveStatic(folder)); | |
https.createServer(options, app).listen(port); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment