title: NodeJs Express - How to return HTTP ERROR CODE (400,401,500) plus JSON OBJECT
body: <p>I have a web api which is using express and NodeJs. This sounds really basic but I could not found a solution. How can I return a response with http status code and Json object? </p>
  
  <p>For example: </p>
  
  <p><strong>res.send(500, {success: false, error 'Sorry, error'});</strong></p>
  
  <p>Even if I return an error http response code, I would like to return a json object. I am trying to use some request methods, but no one of them give the option to set http status code and json object.</p>
  
  <p>I am pretty sure that I might be missing something, because this is really basic for a web api framework.</p>
  
  <p>Thanks in advance.</p>