I am new to express. I have made a simple react front-end with express backend using express generators and currently, this is the way I am sending JSON data:-
var express = require("express");
var router = express.Router();
router.get("/", function(req, res, next) {
var jsonData = {"name": "manav"};
res.json(jsonData);
});
module.exports = router;
but how can I send data from a JSON file instead? I tried creating a JSON file in the same directory and sending it like res.json('./jsonFile'); but it doesn't work. Could someone help me out please?