Skip to content

Instantly share code, notes, and snippets.

@seansullivan
Created August 28, 2014 18:22
Show Gist options
  • Save seansullivan/836613655c3b593ea70e to your computer and use it in GitHub Desktop.
Save seansullivan/836613655c3b593ea70e to your computer and use it in GitHub Desktop.
Lightweight Node.js HTTPS Server
var https = require('https');
var http = require('http');
var fs = require('fs');
var express = require('express');
var options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
};
// Create a service (the app object is just a callback).
var app = express();
app.use(express.static('../'));
// Create an HTTPS service identical to the HTTP service.
https.createServer(options, app).listen(4443);
http.createServer(app).listen(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment