express-flashyo
Flash messaging for Express 4.x
Install
npm install flashyo --save
Initialise
app; // OPTIONALapp;
Use
Response
Using res.flash(message, [level])
or res.flash({ message: '...', customKeys: 123 })
sets values straight away onto the res.locals object (shown in example) so your view engine can render the data.
appapp;
Delayed Response
By using a delayed response requires express-session
to be initialised beforehand. When req.flash(message, [level])
or req.flash({ message: '...', customKeys: 123 });
the message is places in the session so that the next request has the flash message places in res.locals
.
// app.use express-session// app.use(require('express-flashyo')); app; app
Licence: MIT