Files
JJ KasperandGitHub 864f065392 Add updated app dir cache handling (#48516)
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)
2023-04-19 18:12:21 -04:00

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 })
}