{"size": 633, "ext": "js", "max_stars_repo_path": "vegitablesData.js", "max_stars_repo_name": "sakshiagrawal1997/node-repo", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "vegitablesData.js", "max_issues_repo_name": "sakshiagrawal1997/node-repo", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "vegitablesData.js", "max_forks_repo_name": "sakshiagrawal1997/node-repo", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.32, "max_line_length": 68, "alphanum_fraction": 0.6287519747}
const fs = require("fs");

/**
 *  Function to read a file from local project directory
 * and send it back to client side
 * @param {*} pathString 
 * @param {*} res 
 */
function vegitablesData(pathString, res){
    fs.readFile(pathString, function (err, data){
        //  console.log(err, data);
        //  console.log(JSON.parse(data));
         const dataFromFile = JSON.parse(data);
         console.log(dataFromFile.results);
         res.writeHead(200, { "Content-Type": "application/json" });
         res.write(JSON.stringify(dataFromFile));
         res.end();
 });
}





module.exports.vegitablesData = vegitablesData;