ccarruitero / makemehapi

Self guided workshops to teach you about hapi.
https://www.npmjs.com/package/makemehapi
Other
480 stars 107 forks source link

'Directories' exercise seems broken #173

Closed newswim closed 8 years ago

newswim commented 8 years ago

I tried working through the problem, and kept getting

{"statusCode":404,"error":"Not Found"}

My directory structure ->

makemehapi/04-directories/04-directories.js makemehapi/04-directories/public/index.html

I'm even trying the official solution:

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?

Thanks! <3 hapi <3

newswim commented 8 years ago

I needed to name the file file.html !