difference between res.send and res.json in express
res.send()
Sending a response can be achieved by calling the res.send() method.
The signature of this method looks like this: res.send([body]) where the body
can be any of the following: Buffer, String, an Object and an Array.
This method automatically sets the Content-Type response header as well
based on the argument passed to the send() method
res.json()
It send a JSON response. This method is identical to res.send() when an object
or array is passed, but it also converts non-objects to json.
main difference between res.json and res.send comes into picture when you
have to pass non objects as a response. res.json will convert non objects
(ex. null, undefined etc) as well which are actually not a valid JSON whereas
res.send will not convert them.