No description or website provided.
JavaScript
Latest commit 92fd748 Apr 2, 2015 @jonathanong jonathanong Merge pull request #3 from gluxon/master
Add documentation for message consuming
Permalink
Failed to load latest commit information.
test don't show duplicate messages Sep 11, 2014
.gitignore init Sep 4, 2014
.travis.yml init Sep 4, 2014
LICENSE init Sep 4, 2014
README.md Add documentation for message consuming Apr 2, 2015
index.js don't show duplicate messages Sep 11, 2014
package.json 1.1.0 Sep 11, 2014

README.md

flash

NPM version Build status Test coverage Dependency Status License Downloads

The simplest flash implementation for Express.

Usage

npm i flash
app.use(session()); // session middleware
app.use(require('flash')());

app.use(function (req, res) {
  // flash a message
  req.flash('info', 'hello!');
  next();
})
for message in flash
  a.alert(class='alert-' + message.type)
    p= message.message
while message = flash.shift() // consume messages as jade reads them
  a.alert(class='alert-' + message.type)
    p= message.message

API

req.flash([type], msg)

Flash a message defaulting the type to info.

res.locals.flash

An array of flash messages of the form:

{
  "type": "info",
  "message": "message"
}