Created
September 17, 2015 17:10
-
-
Save matthewarkin/1407952dbab4d30e4335 to your computer and use it in GitHub Desktop.
This file contains hidden or 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'); | |
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