tryingHard
tryingHard

Reputation: 2084

Does GraphQL has built in pagination?

Does GraphQL offer built in pagination? Like take first 10 items of collection, offest 2 etc?

I have read here: https://graphql.org/learn/pagination/

On other sites I saw only those examples in which we had to implement these arguments by our own.

Edit: My question is not how to GraphQL: How to implement pagination with graphQL-java? but question - is there built in option for that.

Upvotes: 0

Views: 2152

Answers (1)

Amit Bhoyar
Amit Bhoyar

Reputation: 1057

Its not in build, you need to add input parameters into your api endpoint and then use them to implement pagination. ex- sequelize accepts these parameters as it is and generates query.

yourAPI(filters:yourInputFilters,limit:Int,offset:Int)

Sample with sequelize :

model.findAndCountAll({
            where: filters,
            limit: limit,
            offset: offset
})

Upvotes: 2

Related Questions