Skip to content

Commit

Permalink
wip: add article show page
Browse files Browse the repository at this point in the history
  • Loading branch information
KoichiKiyokawa committed Sep 17, 2022
1 parent 41c4969 commit 04fdccd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions svelte-kit-prisma/src/routes/articles/[slug]/+page.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { db } from '$lib/utils/db.server';
import type { PageServerLoad } from './$types';

export const load: PageServerLoad = async ({ params }) => {
const article = await db.article.findUnique({ where: { slug: params.slug } });
return { article };
};
7 changes: 7 additions & 0 deletions svelte-kit-prisma/src/routes/articles/[slug]/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script lang="ts">
import type { PageData } from './$types';
export let data: PageData;
</script>

<pre>{JSON.stringify(data.article, null, 2)}</pre>

0 comments on commit 04fdccd

Please sign in to comment.