Last active
May 14, 2017 19:00
-
-
Save gorkamu/98ed316a6df60b7a1bf25cace5e7aaef to your computer and use it in GitHub Desktop.
Ejemplo de método PUT en una API REST con Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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