how to access cookies without express ? #1515
Unanswered
codjix
asked this question in
Help & Questions
Replies: 1 comment 5 replies
-
You'll always need some kind of server, since cookies are dynamic (whereas pre-rendered apps are static). So I ain't sure what you want is possible. On the client-side, you can directly access cookies. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
i realy love vike and vite and use them in all my react projects, but i am facing a problem about how to access cookies in server side without using external servers like express.
in my case i need cookies in the server side to render my app with a color scheme cookie stored in the browser and some dynamic react components even for auth, since i use telefunc instead of API i have to install express and some deps just for accessing cookies, so i am looking for another method.
here is how i access cookies with express by adding them in the init context and then passing them with passToClient in some cases :
and here is how i use it :
i hope you provide request's headers or cookies in vike-react's usePageContext or vike itself to use them directly in pages or components without the need of express.
THANKS !
Beta Was this translation helpful? Give feedback.
All reactions