Skip to content

Instantly share code, notes, and snippets.

@jedp
Last active December 15, 2015 06:09
Show Gist options
  • Save jedp/5214262 to your computer and use it in GitHub Desktop.
Save jedp/5214262 to your computer and use it in GitHub Desktop.
static file server
/**
* Static file server
* Drop files in ./public
*/
var
Hapi = require('hapi'),
server = Hapi.createServer('localhost', process.env['STATIC_SERVER_PORT'] || 9000);
server.route({
method: 'GET',
path: '/{path*}',
handler: {
directory: {
path: './public',
listing: true,
index: true
}
}
});
server.start();
console.log("Serving files from", server.settings.uri);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment