Skip to content

Instantly share code, notes, and snippets.

@nvcexploder
Created October 21, 2014 00:59
Show Gist options
  • Save nvcexploder/15d71efb16f926771e73 to your computer and use it in GitHub Desktop.
Save nvcexploder/15d71efb16f926771e73 to your computer and use it in GitHub Desktop.
Creating a TLS server in hapi.js
var Hapi = require('hapi');
var Fs = require('fs');
var options = {
tls: {
key: Fs.readFileSync(your_key),
cert: Fs.readFileSync(your_cert)
}
};
var server = Hapi.createServer('localhost', 4433, options);
server.route({
path: '/',
method: 'GET',
handler: function (request, reply) {
reply({ name: 'Simon Skinner', occupation: 'Slasher of Prices' });
}
});
server.start( function () {
console.log('The Greater Good.');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment