0.0.5 • Published 10 years ago
hapi-droutes v0.0.5
#Another hapi router 0.0.3
Dynamic/pattern whay loading routes in hapi.
Setup
$ npm install hapi-droutes
Example module registration
server.register({
register: require('hapi-droutes'),
options: {
'root':'routes/please/search_in/here',
'match':'resource/*/route.*.js',
'dependencies':['hello','hapi']
}
}, function (err) {
if (err) throw err;
});
the example will match all files in resource/any dir/route.any file.js
Options /node-Glob/
root
: where root and cwd /for package Glob/ will be setmatch
: what to match
Example router
module.exports = function(greet, name) {
return {
method: 'GET',
Path: '/',
handler: function(request, reply) {
return reply(greet + ' ' + name);
}
};
};
TODO
proper log to hapi logdependency injectioncheck for few properties in required route, eg, should have at least method and Path