Categories
JavaScript Answers

How to destroy a cookie with Node.js and Express?

Spread the love

Sometimes, we want to destroy a cookie with Node.js and Express.

In this article, we’ll look at how to destroy a cookie with Node.js and Express.

How to destroy a cookie with Node.js and Express?

To destroy a cookie with Node.js and Express, we can use the res.clearCookie method.

For instance, we write

res.clearCookie("key");

to call clearCookie with the 'key' of the cookie to delete the cookie with key 'key'.

Conclusion

To destroy a cookie with Node.js and Express, we can use the res.clearCookie method.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *