Webinar 11 assignment question

Sir,
How do we implement patch and delete in javascript, any example would help. I did something like this:

todo.delete(’/:id’, (req, res) => {
arr.splice(req.params.id-1, 1)
res.send(arr)
})

todo.patch(’/:id’, (req, res) => {
arr.splice(req.params.id-1, 1)
arr.push({
task: req.body.task,
done: req.body.done
})
res.send(arr)
})

get, post, patch, delete all have similar syntax

first you create a server object,
const server = require('express')

then use that object to call get, post, patch or delete method

server.any_method_name('here_comes_the_url_you_want_to_hit',(request, response, done) => {
    perform_operations_here
})

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.