Skip to content

Instantly share code, notes, and snippets.

@JWally
Created December 19, 2016 22:40
Show Gist options
  • Save JWally/7da9d2f61ae0127310571c88c0def31a to your computer and use it in GitHub Desktop.
Save JWally/7da9d2f61ae0127310571c88c0def31a to your computer and use it in GitHub Desktop.
var http = require("http"),
https = require("https"),
fs = require("fs"),
path = require("path"),
serveStatic = require("serve-static");
// Serve up public/ftp folder
var serve = serveStatic(path_to = path.join(__dirname, ".."));
var options = {
key: fs.readFileSync('./key.pem'),
cert: fs.readFileSync('./cert.pem')
};
// Create server
var server = https.createServer(options, function onRequest (req, res, nxt) {
serve(req, res, function(){
res.end("200");
});
})
// Listen
server.listen(443)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment