Ben Borgers

How to set and delete cookies with Express

March 18, 2020

Setting cookies

res.cookie("token", MY_TOKEN, { maxAge: MILLISECONDS_FROM_NOW_TO_EXPIRE })

There's more options (other than maxAge) described in the Express documentation.

Deleting cookies

res.clearCookie("token")

More blog posts

Subscribe to my newsletter for a monthly round-up of new blog posts and projects Iā€™m working on!

Twitter ↗ RSS feed ↗