#access cookie delivered from server
15 messages · Page 1 of 1 (latest)
Img2 does not show a composable, it shows a server api route.
Where is this code saved in your project?
And are you trying to access the cookie on the client oder server side?
Yes I am trying to access a cookie from an express backend from the nuxt fe
Yeah but your code shows a backend route, can you show the frontend code where you try to access it?
Here is an example on how to use a cookie in the nuxt frontend https://nuxt.com/docs/examples/composables/use-cookie#usecookie
<script setup>
import id64 from '@/composables/idCookie'
</script>
<template>
<div>{{ id64 }} </div>
</template>
this probably is completely wrong, I thought the getCookie was a way to access cookies on the client side
No it's server side
useCookie is client side
and please check the docs on how to define a composable https://nuxt.com/docs/guide/directory-structure/composables#composables-directory
You are trying to define a server backend api route as a frontend composable
The docs are generally a very good way to learn nuxt3 🙂
Thank you sm, I shouldve read it better