node.js - Sails.js - API attribute not changing via PUT -
i following tutorial written node/express , attempting adapt sails. using postman put name : chris @ localhost:1337/api/data/5591bbdedabb79240b34a46b
sails -v 0.11.0 node -v 0.12.4
here controller:
modify_one: function (req, res) { api.findbyid(req.params.data_id, function(err, data, callback) { if (err) res.send(err); data.name = req.body.name; data.update({data_id:req.params.data_id},{$set: {name:req.body.name}}, callback) })
route:
'put /api/data/:data_id': 'apicontroller.modify_one',
if /api/data doesn't show modification. howver res.json(data.name) returns correct change.
any thoughts? must not saving in mongodb?
Comments
Post a Comment