Files
mintel.me/apps/web/app/debug-mdx/route.ts
Marc Mintel 9951a357ac
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 13s
Build & Deploy / 🏗️ Build (push) Failing after 6m9s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🩺 Smoke Test (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
fix(cache): update debug-mdx route to purge entire cache for Server Actions
2026-06-03 16:27:11 +02:00

26 lines
818 B
TypeScript

import { NextResponse, NextRequest } from "next/server";
import { revalidatePath } from "next/cache";
import fs from "fs";
import path from "path";
export async function GET(request: NextRequest) {
try {
const searchParams = request.nextUrl.searchParams;
const pathParam = searchParams.get("path") || "/";
const typeParam =
(searchParams.get("type") as "page" | "layout") || "layout";
// Revalidate the requested path (defaults to entire app via layout)
revalidatePath(pathParam, typeParam);
return NextResponse.json({
success: true,
revalidatedPath: pathParam,
revalidatedType: typeParam,
message: `Cache revalidated for ${pathParam} (${typeParam})`,
});
} catch (err: any) {
return NextResponse.json({ success: false, error: err.message });
}
}