Files
mintel.me/apps/web/app/api/debug-mdx/route.ts
Marc Mintel 53808c416a
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 11s
Build & Deploy / 🏗️ Build (push) Successful in 7m24s
Build & Deploy / 🚀 Deploy (push) Successful in 27s
Build & Deploy / 🩺 Smoke Test (push) Successful in 6s
Build & Deploy / 🔔 Notify (push) Successful in 4s
chore: add temp debug route to purge Next.js cache
2026-06-03 15:39:07 +02:00

31 lines
886 B
TypeScript

import { NextResponse } from "next/server";
import { revalidatePath } from "next/cache";
import fs from "fs";
import path from "path";
export async function GET() {
try {
const POSTS_DIR = path.join(process.cwd(), "content/blog");
let files = [];
if (fs.existsSync(POSTS_DIR)) {
files = fs.readdirSync(POSTS_DIR);
}
// Revalidate the two problematic pages
revalidatePath("/blog/website-as-a-service");
revalidatePath("/blog/zero-overhead-agencies");
revalidatePath("/blog"); // also bust the blog list cache
return NextResponse.json({
success: true,
cwd: process.cwd(),
postsDir: POSTS_DIR,
postsDirExists: fs.existsSync(POSTS_DIR),
files: files,
message: "Cache revalidated for specific paths",
});
} catch (err: any) {
return NextResponse.json({ success: false, error: err.message });
}
}