-
-
Save amandeepmittal/f5bd0631ef73ae7520a04440fe54f70c 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(req, res) { | |
return Todo.findById(req.params.todoId) | |
.then(todo => { | |
if (!todo) { | |
return res.status(400).send({ | |
message: 'Todo List not found' | |
}); | |
} | |
return todo | |
.destroy() | |
res.status(200).send({ message: 'Todo List deleted Successfully' }) | |
.catch(error => res.status(400).send(error)); | |
}) | |
.catch(error => res.status(400).send(error)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment