Filtering, Pagination & Sorting

This is an exciting section of the tutorial where you’ll implement some key features of many robust APIs! The goal is to allow clients to constrain the list of Link elements returned by the feed query by providing filtering and pagination parameters.

Let’s jump in! 🚀


By using PrismaClient, you’ll be able to implement filtering capabilities to your API without too much effort. Similar to the previous chapters, the heavy-lifting of query resolution will be performed by Prisma. All you need to do is forward incoming queries to it.

The first step is to think about the filters you want to expose through your API. In your case, the feed query in your API will accept a filter string. The query then should only return the Link elements where the url or the description contain that filter string.

To implement this feature, you will need to make changes to the feed query.

Unlock the next chapter
Which arguments are typically used to paginate through a list in the Prisma Client API using limit-offset pagination?
skip & take
skip & orderBy
take & where
where & orderBy