Skip to content

Instantly share code, notes, and snippets.

@brunokrebs
Created October 12, 2018 20:06
Show Gist options
  • Save brunokrebs/77cabef8fc4c479fbc0a261917f96efa to your computer and use it in GitHub Desktop.
Save brunokrebs/77cabef8fc4c479fbc0a261917f96efa to your computer and use it in GitHub Desktop.
app.delete('/:id', (req, res) => {
const { id } = req.params;
for (let i = 0; i < questions.length; i++) {
const question = questions[i];
if (question.id === parseInt(id)) {
questions.splice(i, 1);
return res.status(200).send();
}
}
return res.status(500).send();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment