mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This adds the discussed updated cache handling for app dir for more fine grained control over the cached values. Also adds initial `revalidateTag` and `revalidatePath` exports from `next/server` although export location may change. Continuation of https://github.com/vercel/next.js/pull/47720 x-ref: [slack thread](https://vercel.slack.com/archives/C042LHPJ1NX/p1681404363048459)
28 lines
584 B
JavaScript
28 lines
584 B
JavaScript
import { NextResponse } from 'next/server'
|
|
|
|
export const revalidate = 0
|
|
|
|
export async function GET() {
|
|
const data360 = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random',
|
|
{
|
|
next: {
|
|
revalidate: 360,
|
|
tags: ['thankyounext'],
|
|
},
|
|
}
|
|
).then((res) => res.text())
|
|
|
|
const data10 = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random?a=10',
|
|
{
|
|
next: {
|
|
revalidate: 10,
|
|
tags: ['thankyounext'],
|
|
},
|
|
}
|
|
).then((res) => res.text())
|
|
|
|
return NextResponse.json({ data360, data10 })
|
|
}
|