This commit is contained in:
2026-02-11 22:30:04 +09:00
parent be1f627457
commit 30835f78d4
75 changed files with 4878 additions and 143 deletions

25
src/app/puck/api/route.ts Normal file
View File

@@ -0,0 +1,25 @@
import { revalidatePath } from "next/cache";
import { NextResponse } from "next/server";
import fs from "fs";
export async function POST(request: Request) {
const payload = await request.json();
const existingData = JSON.parse(
fs.existsSync("database.json")
? fs.readFileSync("database.json", "utf-8")
: "{}"
);
const updatedData = {
...existingData,
[payload.path]: payload.data,
};
fs.writeFileSync("database.json", JSON.stringify(updatedData));
// Purge Next.js cache
revalidatePath(payload.path);
return NextResponse.json({ status: "ok" });
}