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