server.route({
method: 'GET',
path: '/hello',
handler: function (request, reply) {
return reply('world');
}
});
server.route({
method: 'GET',
path: '/assets',
handler: {
directory: {
path: Path.join(__dirname, 'assets')
}
}
});server.route({
method: 'GET',
path: '/walmart-proxy',
handler: {
proxy: {
uri: 'http://www.walmart.com'
}
}
});exports.register = function (plugin, options, next) {
plugin.route({
path: '/',
method: 'GET',
handler: function (request, reply) {
reply('Hello world');
}
});
next();
};
exports.register.attributes = {
pkg: require('./package.json')
};
require('hapi-peel').create(module, {
port: 8080
});var nestedObject = {
foo: {
bar: {
value: 1
}
},
tacos: [
'Fish'
]
};
Hoek.reach(nestedObject, 'foo.bar.value');
// => 1
Hoek.transform(nestedObject, {
fooBar: 'foo.bar.value',
taco: 'tacos.0'
};
// => { fooBar: 1, taco: 'Fish' }