humble-flash
v0.1.0
Published
Flash message plugin for humble-session and hapi.
Downloads
4
Maintainers
Readme
humble-flash
Flash message plugin for humble-session and hapi.
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