0.0.5 • Published 10 years ago

hapi-droutes v0.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

#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 set
  • match: 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 log
  • dependency injection
  • check for few properties in required route, eg, should have at least method and Path
0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago