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

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.