var Hapi = require('hapi');
var Inert = require('inert');
var Path = require('path');
var server = new Hapi.Server();
server.connection({
host: 'localhost',
port: Number(process.argv[2] || 8080)
});
server.register(Inert, function () {});
server.route({
method: 'GET',
path: '/foo/bar/baz/{filename}',
handler: {
directory: {
path: Path.join(__dirname, 'public')
}
}
});
server.start(function () {});
Node: v4.3.1
NPM: 2.14.12
Note: I've tried moving the /public folder up a level, and running the code from root folder, and a few combinations. Any idea what I might be missing?
I tried working through the problem, and kept getting
My directory structure ->
makemehapi/04-directories/04-directories.js makemehapi/04-directories/public/index.html
I'm even trying the official solution:
Node: v4.3.1 NPM: 2.14.12
Note: I've tried moving the /public folder up a level, and running the code from root folder, and a few combinations. Any idea what I might be missing?
Thanks! <3 hapi <3