Set (send) cookies server side like in Express.js via ctx.res.cookie
See original GitHub issueFeature request
There is no easy way to send cookies from the server in next.js, You can get cookies via ctx.req.headers.cookie so one would expect to send them via ctx.res.[headers].cookie in getInitialProps similar to express.js
Is it something on your radar? Or can you recommended a third party lib to do that?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How can I set cookie in node js using express framework?
use(express. cookieParser()); // set a cookie app. use(function (req, res, next) { // check if client sent cookie var cookie = req. cookies....
Read more >Setting and Using Cookies with a Node.js / Express Server
In this blog I'll be setting up a server using Node.js and Express, and use it to set and receive cookies. To test...
Read more >Cookies | NestJS - A progressive Node.js framework
Nest is a framework for building efficient, scalable Node.js server-side ... Cookies. An HTTP cookie is a small piece of data stored by...
Read more >How to Send Cookies from Express to a Front-End Application ...
In this article, I would be explaining how to send cookies from an Express app via an express-session package to the front end...
Read more >Koa - next generation web framework for node.js
ctx.cookies.set(name, value, [options]). Set cookie name to value with options :.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I know that I can create it myself as well as I can do SSR myself. But the question was different.
It only reads cookies but does not send them in http response. This lib has 4 lines of code.