Skip to content

Instantly share code, notes, and snippets.

@matthewarkin
Created September 17, 2015 17:10
Show Gist options
  • Save matthewarkin/1407952dbab4d30e4335 to your computer and use it in GitHub Desktop.
Save matthewarkin/1407952dbab4d30e4335 to your computer and use it in GitHub Desktop.
var Hapi = require('hapi');
var Path = require('path');
// Create a server with a host and port
var server = new Hapi.Server({
connections: {
routes: {
files: {
relativeTo: Path.join(__dirname, 'public')
}
}
}
});
server.connection({
host: '0.0.0.0',
port: 3000,
});
server.route({
method: 'GET',
path: '/{filename}',
handler: {
file: function (request) {
return request.params.filename;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment