Last Updated: February 25, 2016
· milesmatthias

req.flash is never observant

In a nodejs app that uses connect flash messaging (, it took me a while to realize that the call


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.