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
For adding response headers before send, you can use the setHeader method:
response.setHeader('Content-Type', 'application/json')
The status only by the status method:
response.status(status_code)
Both at the same time with the writeHead method:
response.writeHead(200, {'Content-Type': 'application/json'});