Skip to content

Instantly share code, notes, and snippets.

@apipkin
Last active August 29, 2015 14:06
Show Gist options
  • Save apipkin/f4142ff2e2b79d4693a5 to your computer and use it in GitHub Desktop.
Save apipkin/f4142ff2e2b79d4693a5 to your computer and use it in GitHub Desktop.
Simple hapi.js file server
var Hapi = require('hapi'),
server = new Hapi.Server();
server.connection({
port: 3001
});
server.route({
path: '/{param*}',
method: 'GET',
handler: {
directory: {
path: 'public',
listing:true
}
}
});
server.start(function () {
var info = server.info,
local = info.protocol + '://0.0.0.0:' + info.port,
pub = info.protocol + '://' + info.host + ':' + info.port;
console.log('Local:', local);
console.log('Public:', pub);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment