There is a simple solution to limit the number of items in the list. Use arguments called limit
and skip
. Provide a default value for limit
is also considered a best practice. Use NonNull constraint for limit
to avoid the null
passed as an argument value.
type Query {
articles(limit: Int! = 20, skip: Int): [Article]
}