Download next.js/test/e2e/app-dir/actions/app/handler/route.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 647 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/app/handler/route.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/app-dir/actions/app/handler/route.js
-
curl -L -o route.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/app/handler/route.js
647 Bytes
| import { cookies } from 'next/headers' | |
| export const revalidate = 1 | |
| export const GET = async () => { | |
| const localCookies = await cookies() | |
| localCookies.set('foo', 'foo1') | |
| localCookies.set('bar', 'bar1') | |
| // Key, value, options | |
| localCookies.set('test1', 'value1', { secure: true }) | |
| // One object | |
| localCookies.set({ | |
| name: 'test2', | |
| value: 'value2', | |
| httpOnly: true, | |
| path: '/handler', | |
| }) | |
| // Cookies here will be merged with the ones above | |
| return new Response('Hello, world!', { | |
| headers: [ | |
| ['Content-Type', 'text/custom'], | |
| ['Set-Cookie', 'bar=bar2'], | |
| ['Set-Cookie', 'baz=baz2'], | |
| ], | |
| }) | |
| } | |