Shamoon Shamoon - 5 months ago 7
Node.js Question

How can I send back response headers with Node.js / Express?

I'm using

res.send
and no matter what, it returns status of 200. I want to set that status to different numbers for different responses (Error, etc)

This is using
express

Answer
res.writeHead(200, {'Content-Type': 'text/event-stream'});

http://nodejs.org/docs/v0.4.12/api/http.html#response.writeHead

Comments