Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
import { error, json, type RequestEvent } from '@sveltejs/kit'; | |
// import { env } from '$env/dynamic/private' | |
import jsonData from "$lib/cards.json"; | |
/** @type {import('./$types').RequestHandler} */ | |
export async function GET(request : RequestEvent) { | |
const hasError = false | |
const page = parseInt(request.url.searchParams.get('page') || '0') | |
if (hasError) { | |
return error(500, 'Internal Server Error') | |
} | |
const cards = jsonData.slice(page * 25, page * 25 + 25) | |
return json({ | |
cards, | |
total_items: jsonData.length, | |
}) | |
} | |