Say my database schema has blog posts with attributes id, title, and content.app.get('/', (req, res) => { /** code to get all blog posts */ } app.put('/', (req, res) => { /** code to add a blog post where body contains title and content */ } app.post('/:id', (req, res) => { /** code to edit blog post with id = :id */ } app.delete('/:id', (req, res) => { /** code to delete blog post with id = :id */ } My question is, for the post and delete requests, should I pass in the id in req.params, or the body of the request (req.body)?What is considered best practice?Thank you!
Submitted August 22, 2018 at 05:06AM by v_95
No comments:
Post a Comment