simple-flash
Simple Flash is a very simple way to set flash messages in Express routes.
Installation
npm install simple-flash
Usage
In your app.js (after session setup line):
var flash = ;app;
In your route, only add your messages using the new funcion req.flash(type,message)
:
app
For render messages in view, simpliest use the new local function flash()
to return messages array.
Jade example:
for message in flash().row.col-xs-12div(class="alert alert-#{message.type}") #{message.message}
Or:
- flash().forEach(function(message){.row.col-xs-12div(class="alert alert-#{message.type}") #{message.message}- })
For development and tests:
git clone https://github.com/thiagobs/simple-flash.git && cd simple-flashnpm install
Run tests:
npm test