Skip to content

Instantly share code, notes, and snippets.

@gorkamu
Last active May 14, 2017 19:00
Show Gist options
  • Select an option

  • Save gorkamu/98ed316a6df60b7a1bf25cace5e7aaef to your computer and use it in GitHub Desktop.

Select an option

Save gorkamu/98ed316a6df60b7a1bf25cace5e7aaef to your computer and use it in GitHub Desktop.
Ejemplo de método PUT en una API REST con Node.js
function updateAlbum(req, res){
var params = req.body;
var albumId = req.params.id;
Album.findByIdAndUpdate(albumId, params, function(err, album){
if(err){
res.status(500).send({message: 'Error 500 al actualizar el album'});
}else{
res.status(200).send(album);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment