#How to get cookies in a API route

2 messages · Page 1 of 1 (latest)

boreal cometBOT
#

Hi @rugged walrus. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To get cookies in an API route, you can use the context.cookies utility. Here's an example of how to access cookies in an API route:

export async function get({ context }) {
  const cookie = context.cookies.get('your_cookie_name');
  // ...
}

For more information, refer to the context.cookies section (https://docs.astro.build/en/reference/api-reference#contextcookies) in the API reference.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

Astro Documentation

Build faster websites with less client-side JavaScript.