flash

Simple flash messages for Express

  • flash

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
flash
91101.1.08 years ago10 years agoMinified + gzip package size for flash in KB

Readme

flash
!NPM versionnpm-imagenpm-url !Build statustravis-imagetravis-url !Test coveragecoveralls-imagecoveralls-url !Dependency Statusdavid-imagedavid-url !Licenselicense-imagelicense-url !Downloadsdownloads-imagedownloads-url
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

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"
}