jaredhanson / connect-flash

Flash message middleware for Connect and Express.
MIT License
1.24k stars 158 forks source link

Why are flashes always arrays? #10

Closed samholmes closed 11 years ago

samholmes commented 11 years ago

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');

?

jaredhanson commented 11 years ago

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.