返回 CodeWhale
route.ts
根目录 / web / app / api / github / feed / route.ts
1 import { NextResponse } from "next/server";
2 import { fetchFeed } from "@/lib/github";
3
4 export const revalidate = 600;
5 export const dynamic = "force-static";
6
7 export async function GET() {
8 // This route is public. Never spend the server-held GitHub token on behalf
9 // of an unauthenticated caller; scheduled/private tasks use it separately.
10 const items = await fetchFeed(undefined, 50);
11 return NextResponse.json({ items, fetchedAt: new Date().toISOString() });
12 }
13
13 lines TYPESCRIPT