Created
July 29, 2017 08:52
-
-
Save aofleejay/c13facd7fa7ba288c16851a282808ff3 to your computer and use it in GitHub Desktop.
Create delete book api
This file contains hidden or 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
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