2pz7hheja: Add public discovery proxy at GET /api/discover
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user