Files
rednote-tool-studio/app/api/projects/[id]/build/route.ts
T
2026-09-17 21:54:33 +08:00

17 lines
654 B
TypeScript

import { NextResponse } from "next/server";
import { buildProject } from "../../../../../lib/build";
import { errorResponse } from "../../../../../lib/http";
import { touchProject } from "../../../../../lib/storage";
export const runtime = "nodejs";
export const maxDuration = 60;
export async function POST(_: Request, context: { params: Promise<{ id: string }> }) {
try {
const { id } = await context.params;
await touchProject(id);
const result = await buildProject(id);
return NextResponse.json({ report: result.report, previewUrl: `/api/projects/${id}/preview/index.html` });
} catch (error) { return errorResponse(error); }
}