next.js/test/e2e/app-dir/segment-cache/prefetch-inlining/app/api/revalidate-path/route.ts
route.ts14 lines392 B
import { revalidatePath } from 'next/cache'
import { NextRequest, NextResponse } from 'next/server'

export async function GET(req: NextRequest) {
  const path = req.nextUrl.searchParams.get('path') || '/'

  try {
    revalidatePath(path)
    return NextResponse.json({ revalidated: true, path })
  } catch {
    return NextResponse.json({ revalidated: false, path }, { status: 500 })
  }
}
Quest for Codev2.0.0
/
SIGN IN