Daviddolor's picture
Single-process Chromium, fixed visual-polish prompt, Docker config for HF Space
ec675f2
Raw
History Blame Contribute Delete
709 Bytes
import { NextRequest, NextResponse } from "next/server";
import { crawlPage } from "@/lib/crawler";
import { analyzeCSS } from "@/lib/analyzer";
export async function POST(req: NextRequest) {
try {
const body = await req.json();
const url = body.url || body.reference;
if (!url) {
return NextResponse.json(
{ error: "Missing URL" },
{ status: 400 }
);
}
const crawl = await crawlPage(url, "");
const analysis = await analyzeCSS(crawl.css.join("\n"));
return NextResponse.json({
ok: true,
crawl,
analysis
});
} catch (e: any) {
return NextResponse.json(
{ error: e.message },
{ status: 500 }
);
}
}