Ryan dd2477390c Who he is: live Wikipedia bio (auto-refreshed every 15-min crawl tick) + article link
- lib/bio.js: refreshBio() pulls the article intro via the Wikipedia API
  (exintro, descriptive UA) and upserts the bio cache; getBio() reads it
  with a short accurate static fallback. Page loads NEVER hit Wikipedia.
- crawl route: refreshBio() runs on every 15-min tick (over daily) —
  best-effort, a wiki hiccup can't fail the news crawl.
- /api/bio: read-only route.
- page.js: WhoBox renders the live text + 'Full article on Wikipedia' link
  + SOURCE: WIKIPEDIA · UPDATED <date> line.
- tests/bio-test.mjs: fallback + live-refresh + offline degradation.
2026-09-16 17:47:20 +00:00

18 lines
668 B
JavaScript

import { NextResponse } from "next/server";
// The live "Who he is" bio. READ-ONLY: it returns the cached copy that the
// crawl tick refreshes from Wikipedia (lib/bio.js). A page load never calls
// Wikipedia — so this is fast and a wiki outage can't break the front page
// (getBio() falls back to a short static blurb).
export const dynamic = "force-dynamic";
export async function GET() {
try {
const { getBio } = await import("../../../lib/bio");
const bio = await getBio();
return NextResponse.json({ ok: true, ...bio });
} catch (e) {
return NextResponse.json({ ok: false, error: String((e && e.message) || e) }, { status: 500 });
}
}