node.js - Modify Express sessions on set and get -
i'm wondering if there's way (globally via express middleware) intercept , set of session objects.
so, instance if somewhere in 1 of controllers set req.session.foo = 'bar'
can change bar
baz
, when req.session.foo
accessed can send bar
.
i'm not sure trying accomplish should take @ connect-flash middleware store messages in requests.
from docs:
app.get('/flash', function(req, res){ // set flash message passing key, followed value, req.flash(). req.flash('info', 'flash back!') res.redirect('/'); }); app.get('/', function(req, res){ // array of flash messages passing key req.flash() res.render('index', { messages: req.flash('info') }); });
Comments
Post a Comment