Basic post display

This commit is contained in:
2023-04-01 14:31:29 +02:00
parent dccb94a792
commit d2f2214d65
13 changed files with 4325 additions and 2891 deletions

View File

@ -0,0 +1,15 @@
import { getPosts } from '$lib/server/db';
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
export const GET = (async ({ url }) => {
const since = url.searchParams.get('since');
let count = Number.parseInt(url.searchParams.get('count') || '');
if (isNaN(count)) {
count = 20;
}
count = Math.min(count, 100);
const posts = await getPosts(since, count);
return json(posts);
}) satisfies RequestHandler;