Hi Mosh, in your Next.js Part 2 course, you are using two different approaches. When creating issues, you define an API (POST method) in which a post is created using prisma.issue.create({})
. However, when viewing the issues, you simply use prisma.issue.findMany()
without defining any API (GET). Could you please clarify which one is considered best practice?
The prisma client lives on the server. So a server component can directly access the database while a client component needs an api endpoint to do so.
1 Like