Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

635 B
Raw Blame
import { writeFile } from "node:fs/promises";
import path from "node:path";
import { type NextRequest, NextResponse } from "next/server";

const TARGET = path.join(
  process.cwd(),
  "app",
  "(home)",
  "components",
  "landing",
  "sections",
  "whats-inside",
  "bento.json",
);

export async function POST(request: NextRequest) {
  if (process.env.NODE_ENV === "production") {
    return new NextResponse("Not found", { status: 404 });
  }

  const body = await request.json();
  await writeFile(TARGET, `${JSON.stringify(body, null, 2)}\n`, "utf8");

  return NextResponse.json({ path: path.relative(process.cwd(), TARGET) });
}