Node.js and Express with HTTPS

Quoting from the doco + some missing stuff:

var express = require('express');
var https = require('https');
var http = require('http');
var app = express();
var fs = require('fs');

var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};

http.createServer(app).listen(80);
https.createServer(options, app).listen(443);

nJoy 😉

Write a Reply or Comment

Your email address will not be published.