next.js/test/e2e/app-dir/app-static/app/stale-cache-serving/route-handler/route.ts
route.ts17 lines465 B
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 })
}
Quest for Codev2.0.0
/
SIGN IN