hapi-waterfall

0.2.0 • Public • Published

hapi-waterfall

Installation

npm install hapi-waterfall --save

Usage

server.register(require('hapi-waterfall'), function(err) {
  //do stuff
});
 
server.route({
  method: 'GET',
  path: '/',
  handler: {
    waterfall: [
      function(request, reply) {
        reply(null, request, new Date());
      },
      'getWeather', //Named helper from addHelper()
      function(request, date, weather, reply) {
        reply('Todays date is ' + date + ' and the weather is ' + weather);
      }
    ]
  }
});

See the async docs for waterfall. All functions behave like normal waterfall methods with the exception of the last which acts like a normal hapi handler.

Methods

server.plugins.waterfall.addHelper('getWeather', function(request, reply) {
  reply(null, 'nice');
});
 
var registeredMethods = server.plugins.waterfall.getHelpers();

/hapi-waterfall/

    Package Sidebar

    Install

    npm i hapi-waterfall

    Weekly Downloads

    3

    Version

    0.2.0

    License

    MIT

    Last publish

    Collaborators

    • jga