I want to update an attribute within a JSON object using fetch PUT. I've created a put function taking in 2 URL parameters
app.put('/trustRoutes/:id/:item', (req, res){
I am able to update the data with a single parameter but since I only want to change one value inside that object, calling put will replace the whole object with my new body.
below is what I've tried.
app.put('/trustRoutes/:id/:item', (req, res) => {
    readFile(data => {
 
      const userId = req.params['id/item'];
      // have also tried const userId = req.params.id.item
      data[userId] = req.body;
  
//write data back to file 
I looked around at other examples but couldn't find any that were updating data instead of GET. If there is one I missed please let me know.
 
    