You don’t have to worry about over-fetching when using Prisma. Just use the .findMany
method from Prisma and pass it an object with a select
property. In the select
you can choose exactly what properties that you want off of objects fetched from the database.
We’ll continue following the .server file pattern we established in an earlier lesson and create an async function in post.server.ts
that fetches posts with only their slugs and titles. We can then use this function in our components.