How to send Json response in express js
Usually, API calls or request are handled by sending a response using res.send(…). You can equally send a json response using the in-built res.json() method.
This method accepts an object and converts it to json during response.
Below is a simple express app with one route running on port 3000.