react-code-dataset / next.js /test /e2e /app-dir /app-static /app /stale-cache-serving /route-handler /route.ts
Download next.js/test/e2e/app-dir/app-static/app/stale-cache-serving/route-handler/route.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 465 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/app-static/app/stale-cache-serving/route-handler/route.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/app-dir/app-static/app/stale-cache-serving/route-handler/route.ts
-
curl -L -o route.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/app-static/app/stale-cache-serving/route-handler/route.ts
465 Bytes
| import { NextRequest, NextResponse } from 'next/server' | |
| export const revalidate = 0 | |
| const delay = 3000 | |
| export async function GET(req: NextRequest) { | |
| const start = Date.now() | |
| const data = await fetch( | |
| `https://next-data-api-endpoint.vercel.app/api/delay?delay=${delay}`, | |
| { next: { revalidate: 3 } } | |
| ).then((res) => res.json()) | |
| const fetchDuration = Date.now() - start | |
| return NextResponse.json({ fetchDuration, data, now: Date.now(), start }) | |
| } | |