● Zion Boggan
repos/Docket/app/api/changes/route.ts
zionboggan.com ↗
11 lines · typescript
History for this file →
1
import { NextResponse, type NextRequest } from "next/server";
2
import { getChangeEvents } from "@/lib/feed";
3
 
4
export const dynamic = "force-dynamic";
5
 
6
export async function GET(req: NextRequest) {
7
  const sp = req.nextUrl.searchParams;
8
  const raw = parseInt(sp.get("limit") ?? "", 10);
9
  const limit = Number.isFinite(raw) && raw > 0 ? Math.min(raw, 200) : 25;
10
  return NextResponse.json({ items: getChangeEvents(limit) });
11
}