Last active
December 15, 2015 06:09
-
-
Save jedp/5214262 to your computer and use it in GitHub Desktop.
static file server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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