feat: initialize monorepo with full dev team best practices
- Unified monorepo with backend (Express), frontend (Next.js), and devops - Backend: ESLint, Prettier, Jest tests (3 passing), health endpoint, .env.example - Frontend: Fixed build errors, fixed all lint errors (0 remaining), tests passing - DevOps: Docker Compose with PostgreSQL, backend, frontend + healthchecks - CI/CD: 3 GitHub Actions workflows (backend, frontend, docker integration) - DX: Husky pre-commit hooks with smart change detection - Docs: Root README with architecture, CONTRIBUTING.md, PR template Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { getSupabaseAdmin } from "@/lib/admin";
|
||||
import { supabase } from "@/lib/supabase";
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
// Replace this with your actual database query
|
||||
const { data: competitors, error } = await supabase
|
||||
.from("competitor_metrics")
|
||||
.select("*");
|
||||
|
||||
if (error) throw error;
|
||||
|
||||
// Transform the data to match the CompetitorData type
|
||||
const transformedData = {
|
||||
yourSite: {
|
||||
// Your site's data
|
||||
},
|
||||
competitors: competitors.map((competitor) => ({
|
||||
id: competitor.id,
|
||||
name: competitor.name,
|
||||
url: competitor.url,
|
||||
// Transform competitor data
|
||||
})),
|
||||
};
|
||||
|
||||
return NextResponse.json(transformedData);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to fetch competitor data" },
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user