2pz7hheja: Add public discovery proxy at GET /api/discover

This commit is contained in:
2026-10-19 17:26:19 -06:00
parent 0e1225242c
commit 6201fb0d28
5 changed files with 302 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import { NextResponse } from "next/server";
import { getDiscover } from "@/lib/discover";
// GET /api/discover
// Same-origin proxy for Minnect's PUBLIC discovery data. No session needed.
// Returns { featuredExperts, trendingMinnects, categories }, public fields only.
// Upstream failure -> 502 { error: "discover_unavailable" } (never empty arrays,
// so the UI can tell "nothing to show" from "could not load").
export const runtime = "nodejs";
export async function GET() {
const result = await getDiscover();
if (!result.ok) {
return NextResponse.json({ error: result.error }, { status: result.status });
}
return NextResponse.json(result.data);
}