refactor: flatten monorepo structure to backend/ frontend/ devops/
Rename subdirectories for a cleaner single-repo layout: - website-monitoring-backend/ → backend/ - website-monitoring-frontend/ → frontend/ - website-monitoring-devops/ → devops/ Update all references in package.json scripts, CI workflows, docker-compose, pre-commit hooks, and documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { getSupabaseAdmin } from "@/lib/admin";
|
||||
import { supabase } from "@/lib/supabase";
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
const { websiteId } = await request.json();
|
||||
|
||||
// Create a new scan
|
||||
const { data: scan, error: scanError } = await supabase
|
||||
.from("scans")
|
||||
.insert([
|
||||
{
|
||||
website_id: websiteId,
|
||||
status: "pending",
|
||||
},
|
||||
])
|
||||
.select()
|
||||
.single();
|
||||
|
||||
if (scanError) throw scanError;
|
||||
|
||||
// Trigger the analysis process
|
||||
const response = await fetch("/api/analyze", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
websiteId,
|
||||
scanId: scan.id,
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to start analysis");
|
||||
}
|
||||
|
||||
return NextResponse.json({ success: true, scanId: scan.id });
|
||||
} catch (error) {
|
||||
console.error("Monitor start error:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to start monitoring" },
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user