I have using Next.js for client and node and express application for backend.
I am not using nextjs api routes for backend.
frontend on port 3000, backend 3001
I want to access the cookies in my node application, which shows undefined at the moment.
- I am sure the cookies are present as it is visible in the devtools
- Probably not a cors issue
I am able to access the cookie in nextjs in getServerSideProps and pass the cookie in headers.
const res = await fetch(url,
{
headers: {
Cookie: context.req.cookies.session,
},
}
);
Suppose I have a mutation for creating a post, How do I pass the cookie to my backend(I cant use getServersideprops for that).