Why can’t we do multiple response.send in Express.js?

Maybe you need: response.write

response.write("foo");
response.write("bar");
//...
response.end()

res.send implicitly calls res.write followed by res.end. If you call res.send multiple times, it will work the first time. However, since the first res.send call ends the response, you cannot add anything to the response.

Leave a Comment