subman-nextjs/src/app/story/[id]/page.tsx

15 lines
341 B
TypeScript

import prisma from "../../lib/db.mjs"
async function getStory(id: string) {
const story = await prisma.story.findFirst({ where: { id: Number(id) } })
return story
}
export default async function Page({ params }: { params: { id: string } }) {
const data = await getStory(params.id)
return <div>Title: {data?.title ?? ""}</div>
}