Skip to content

Instantly share code, notes, and snippets.

@amandeepmittal
Created December 3, 2018 04:36
Show Gist options
  • Save amandeepmittal/f5bd0631ef73ae7520a04440fe54f70c to your computer and use it in GitHub Desktop.
Save amandeepmittal/f5bd0631ef73ae7520a04440fe54f70c to your computer and use it in GitHub Desktop.
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