Created
June 1, 2011 10:48
-
-
Save jeromeetienne/1002105 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// attempts to get flash/session accessible in any template | |
// - this middleware function fails and keep producing 'Error: req.flash() requires sessions' | |
// - this middleware has been place *after* session middleware in the stack | |
app.use(function(req,res, next){ | |
console.log("flash middleware") | |
res.locals({ | |
session : req.session, | |
flash : req.flash() | |
}); | |
}); |
thanks @AlejandroMG, I'm was with "req.flash() requires sessions" error too, and this works for me as well.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@AlejandroMG, thx for the tip; works well