mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This ensures we properly bail from caching POST requests when a route is dynamic e.g. a POST route handler
13 lines
267 B
JavaScript
13 lines
267 B
JavaScript
import { NextResponse } from 'next/server'
|
|
|
|
export async function POST() {
|
|
const data = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random',
|
|
{
|
|
method: 'POST',
|
|
}
|
|
).then((res) => res.text())
|
|
|
|
return NextResponse.json({ data })
|
|
}
|