jaredhanson / connect-flash

Flash message middleware for Connect and Express.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why are flashes always arrays?

samholmes opened this issue · comments

Why is it that in order to access:

req.flash('message', 'You forgot to enter something');

I have to do:

req.flash('message')[0];

instead of:

req.flash('message');

?

That's the API.

This was extracted from Express 2.x, for compatibility after it was removed from Express 3.x. There original code is here: https://github.com/visionmedia/express/blob/2.5.11/lib/request.js#L189

This module behaves identically.