diff --git a/src/routes/api/v1/posts/+server.ts b/src/routes/api/v1/posts/+server.ts index a14fca6..8c694a2 100644 --- a/src/routes/api/v1/posts/+server.ts +++ b/src/routes/api/v1/posts/+server.ts @@ -12,7 +12,7 @@ export const GET: RequestHandler = async ({ platform, url }) => { const { results } = await db .prepare( ` - SELECT p.id, p.slug, p.title, p.published_at, p.updated_at, c.slug as category_slug + SELECT p.id, p.slug, p.title, p.published_at, p.updated_at, c.slug as category_slug, c.name as category_name FROM posts p LEFT JOIN categories c ON p.category_id = c.id ORDER BY p.published_at DESC diff --git a/src/routes/api/v1/posts/[slug]/+server.ts b/src/routes/api/v1/posts/[slug]/+server.ts index e72ca5d..4c798d1 100644 --- a/src/routes/api/v1/posts/[slug]/+server.ts +++ b/src/routes/api/v1/posts/[slug]/+server.ts @@ -11,7 +11,7 @@ export const GET: RequestHandler = async ({ params, platform }) => { const post = await db .prepare( ` - SELECT p.id, p.slug, p.title, p.content, p.published_at, p.updated_at, c.slug as category_slug + SELECT p.id, p.slug, p.title, p.content, p.published_at, p.updated_at, c.slug as category_slug, c.name as category_name FROM posts p LEFT JOIN categories c ON p.category_id = c.id WHERE p.slug = ?