mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
17 lines
467 B
TypeScript
17 lines
467 B
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
|
|
export const runtime = 'edge'
|
|
|
|
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 })
|
|
}
|