Skip to content

Instantly share code, notes, and snippets.

@samuelkadolph
Created June 4, 2011 19:22
Show Gist options
  • Save samuelkadolph/1008240 to your computer and use it in GitHub Desktop.
Save samuelkadolph/1008240 to your computer and use it in GitHub Desktop.
app.js
var fs = require("fs");
var http = require("http");
var https = require("https");
var express = require("express");
var app = express.createServer();
var httpsOptions = {
key: fs.readFileSync(process.env.HOME + "/localhost-key.pem"),
cert: fs.readFileSync(process.env.HOME + "/localhost-cert.pem")
};
var handler = function(request, response) {
app.emit("request", request, response);
};
var httpServer = http.createServer(handler);
var httpsServer = https.createServer(httpsOptions, handler);
httpServer.listen(80);
httpsServer.listen(443);
var fs = require("fs");
var http = require("http");
var https = require("https");
var express = require("express");
var app = express.createServer();
var httpsOptions = {
key: fs.readFileSync(process.env.HOME + "/localhost-key.pem"),
cert: fs.readFileSync(process.env.HOME + "/localhost-cert.pem")
};
var handler = function(request, response) {
app.emit("request", request, response);
};
var httpServer = http.createServer(handler);
var httpsServer = https.createServer(httpsOptions, handler);
httpServer.listen(80);
httpsServer.listen(443);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment