Fixing Exports Update - ashish9342/FreeCodeCamp GitHub Wiki

Fixing exports.update

As it turns out, in thing.controller.js as well as in any other endpoints you may generate, the exports.update function that is called when you make an $http.put call from your frontend to modify an existing database object is broken. This is a known issue, and can be fixed by changing the following line:

// Updates an existing thing in the DB.
exports.update = function(req, res) { 
...    
    var updated = _.extend(thing, req.body); 
    // change _.merge to _.extend
... 
 };

PREVIOUS NEXT

⚠️ **GitHub.com Fallback** ⚠️