Created
July 29, 2017 09:01
-
-
Save aofleejay/2570cd4e97a3193e88c43f0d55dd244a to your computer and use it in GitHub Desktop.
Create update 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.put('/books/:id', (req, res) => { | |
const updateIndex = books.findIndex(book => book.id === req.params.id) | |
res.json(Object.assign(books[updateIndex], req.body)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment