0.1.0 • Published 9 years ago

humble-flash v0.1.0

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

humble-flash

Flash message plugin for humble-session and hapi.

Dependency Status Build Status npm version

Installation

npm i --save humble-flash

Usage

Note. This module requires humble-session to be registered as well.

TODO: write usage example

API

Adds a new flash message of a specified type to the session.

Arguments

type - String - The type of the flash message. message - String - The text of the message. cb(err) - Function - A function that is called once the flash message was saved to the session.

Creates a pre-handler that fetches the messages of the specified type from the session and removes them from it.

Arguments

type - String - The type of the messages to return.

Usage

var humbleFlash = require('humble-flash');

// ...
server.route({
  method: 'GET',
  path: '/',
  config: {
    pre: [humbleFlash.createPreHandler('info')]
  },
  handler: function(request, reply) {
    reply(request.pre.info);
  }
});

License

MIT

0.1.0

9 years ago

0.0.0

9 years ago