ccarruitero / makemehapi

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

I cannot validate the "directories" challenge #178

Closed eakl closed 8 years ago

eakl commented 8 years ago

The "directories" challenge requires to access the specific path foo/bar/bar/file.html to validate.

My code executes well on node.js

'use strict';

const Hapi  = require('hapi');
const Inert = require('inert');
const Path  = require('path');

const server = new Hapi.Server();

server.connection({
    host: 'localhost',
    port: Number(process.argv[2] || 8080)
});

server.register(Inert, (err) => {
    if (err) throw err;
});

server.route({
    method: 'GET',
    path: '/foo/bar/baz/{param?}',
    handler: {
        directory: {
            path: Path.join(__dirname, 'public')
        }
    }
});

server.start(() => {
    console.log('Server running at: ' + server.info.uri);
});

But fails with makemehapi run and makemehapi verify

eakl@xxx:~$ makemehapi verify directories.js 
Server running at: http://localhost:27586
✗ Status code 404 returned from url http://localhost:27586/foo/bar/baz/file.html, expected 200.

# FAIL

Your solution to DIRECTORIES didn't pass. Try again!

My server launch at http://localhost:27586 without the path to index.html

makemehapi doesn't verify this automatically? Should I pass an argument to makemehapi verify with the path?

eakl commented 8 years ago

In my public directory, my file was index.html, not file.html