Skip to content

Instantly share code, notes, and snippets.

@aofleejay
Created July 29, 2017 08:52
Show Gist options
  • Save aofleejay/c13facd7fa7ba288c16851a282808ff3 to your computer and use it in GitHub Desktop.
Save aofleejay/c13facd7fa7ba288c16851a282808ff3 to your computer and use it in GitHub Desktop.
Create delete book api
app.delete('/books/:id', (req, res) => {
const deletedIndex = books.findIndex(book => book.id === req.params.id)
books.splice(deletedIndex, 1)
res.status(204).send()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment