javascript delete cookie
To delete a cookie in Node.js using JavaScript, you can follow these steps:
- Access the request object to get the cookies using
req.cookies
. - Set the cookie that needs to be deleted to a value of 'null' using
res.cookie('cookieName', null, { maxAge: 0 })
. - Send the response back with the updated cookie using
res.send('Cookie deleted')
.