adding files

This commit is contained in:
zach
2026-02-17 13:07:29 -05:00
parent fe2abf4dd2
commit a7cd682827
9 changed files with 129 additions and 0 deletions

18
src/pages/api/cards.ts Normal file
View File

@@ -0,0 +1,18 @@
import type { APIRoute } from "astro";
import { db } from "../../db";
export const GET: APIRoute = async ({ url }) => {
const page = Number(url.searchParams.get("page") ?? 0);
const PAGE_SIZE = 256;
const cards = await db.query.cards.findMany({
where: { productLineName: "pokemon" },
limit: PAGE_SIZE,
offset: page * PAGE_SIZE,
with: { prices: true }
});
return new Response(JSON.stringify(cards), {
headers: { "Content-Type": "application/json" },
});
};