calvh / mooden

A simple tool to track your mood
0 stars 1 forks source link

Replace res.json with res.send({}) #53

Closed calvh closed 3 years ago

calvh commented 3 years ago

see https://blog.fullstacktraining.com/res-json-vs-res-send-vs-res-end-in-express/

To sum things up, res.json() allows for extra formatting of the JSON data - if this is not required res.send() can also be used to return a response object using Express. Both of these methods also end the response correctly, and there's no further action required.

calvh commented 3 years ago

res.json() sets the correct content type in the header so it is better to use res.json()