Skip to content

Instantly share code, notes, and snippets.

@aofleejay
Created July 29, 2017 09:01
Show Gist options
  • Save aofleejay/2570cd4e97a3193e88c43f0d55dd244a to your computer and use it in GitHub Desktop.
Save aofleejay/2570cd4e97a3193e88c43f0d55dd244a to your computer and use it in GitHub Desktop.
Create update book api
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