// required packages var bodyParser = require('body-parser'); var urlencodedParser = bodyParser.urlencoded({extended: false}); var fs = require('fs'); // read the data file function readData(fileName){ let dataRead = fs.readFileSync('./data/' + fileName + '.json'); let infoRead = JSON.parse(dataRead); return infoRead; } // read the data file function writeData(info, fileName){ data = JSON.stringify(info); fs.writeFileSync('./data/' + fileName + '.json', data); } // update the data file, I use "name" to be equal to fruit, or animal or color // to match with the file names // I assume we always just add 1 to a single item function combineCounts(name, value){ // console.log(value); info = readData(name); // will be useful for text entry, since the item typed in might not be in the list var found = 0; for (var i=0; i