Last Updated: February 25, 2016
·
1.151K
· milesmatthias

req.flash is never observant

In a nodejs app that uses connect flash messaging (http://extjs.github.com/Connect/flash.html), it took me a while to realize that the call

req.flash()

is never just a read-only view of what messages are in the flash object.

If you give it a message to flash, it will store it.

If you don't give it a message, it will pop off whatever messages correspond to the message type you gave it.

Look very closely at Connect's flash page and you'll understand what I mean.