I'm new to Express and I'm currently learning how to flash messages. When we use a module such as connect-flash
, we are supposed to do it in the format req.flash(type,message)
. We cannot call .flash()
on a response res
. Why is it that we do the flash
on the request rather than the response? It seems to make more intuitive sense that the response, which is being output to the client, would be the place for the flash rather than the request. This makes me think that I'm misunderstanding what exactly is happening here, so I would appreciate a clarification on this.
Asked
Active
Viewed 36 times
0

rb612
- 5,280
- 3
- 30
- 68
-
The person who created `express` will be the best one to answer this for you. – Ankit Agarwal May 19 '18 at 08:00
-
@AnkitAgarwal haha, I'm sure that would be true, except I want to clarify and make sure that it's purely convention rather than me misunderstanding what's happening here. – rb612 May 19 '18 at 08:01