Last active
August 29, 2015 14:18
-
-
Save adicirstei/da9b55d2039e3e81dd38 to your computer and use it in GitHub Desktop.
This file contains 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
destroy: function(req, res) { | |
var id = req.param('id'); | |
MyModel.findOne(id) | |
.exec(function foundRecord (err, record) { | |
if (err) return res.serverError(err); | |
if(!record) return res.notFound('No record found with the specified `id`.'); | |
MyModel.destroy(id) | |
.exec(function(err) { | |
if (err) return res.negotiate(err); | |
return res.ok(record); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment