Files
JJ KasperandGitHub ce746ef5c2 Handle unstable_cache in pages (#49624)
Ensures this method works in pages the same as in app as discussed. 

x-ref: [slack
thread](https://vercel.slack.com/archives/C042LHPJ1NX/p1683242040712889)
x-ref: [slack
thread](https://vercel.slack.com/archives/C042LHPJ1NX/p1683724596461329)
2023-05-10 13:59:48 -07:00

15 lines
252 B
JavaScript

import { unstable_cache } from 'next/cache'
export default async function handler(req, res) {
const data = await unstable_cache(async () => {
return {
random: Math.random(),
}
})()
res.json({
now: Date.now(),
data,
})
}