Last active
August 29, 2015 14:06
-
-
Save apipkin/f4142ff2e2b79d4693a5 to your computer and use it in GitHub Desktop.
Simple hapi.js 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
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