vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.22k stars 27.02k forks source link

I have the same problem. How can we set cookies other than in the middleware? Can someone show an example on how to set a cookie from a route handler as said possible in the docs? This became a life-or-death matter to me, I've been stuck for 2 days trying to figure out how I can manage to create a simple cookie... #60075

Closed kamaleldinmostafa closed 10 months ago

kamaleldinmostafa commented 10 months ago
          I have the same problem. How can we set cookies other than in the middleware? Can someone show an example on how to set a cookie from a route handler as said possible in the docs? This became a life-or-death matter to me, I've been stuck for 2 days trying to figure out how I can manage to create a simple cookie...

Originally posted by @kapsule-studio in https://github.com/vercel/next.js/issues/51875#issuecomment-1641438751

kmvan commented 10 months ago

How about this: https://github.com/vercel/next.js/tree/canary/examples/with-cookies-next

samcx commented 10 months ago

Hi @kamaleldinmostafa, please open a new issue so the full template is used with the required information so we can properly triage this issue!

github-actions[bot] commented 10 months ago

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.