Implement Pagination on the Backend
See original GitHub issueWe need to implement pagination when the user loads posts. We’ll implement lazy loading on the frontend in https://github.com/FightPandemics/FightPandemics/issues/127
@robinv85 thinks this might be best handled using mongo “skip” and “limit” parameters https://fightpandemics.slack.com/archives/C010V0DDHLN/p1586966620489600?thread_ts=1586966336.487500&cid=C010V0DDHLN
Let’s shoot for loading 5 posts at a time
Check out backend/lib/endpoints/schema/posts.js
:
const getPostsSchema = {
querystring: S.object()
.prop("authorId", S.string())
.prop("skip", S.integer())
.prop("limit", S.integer()),
};```
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Everything You Need to Know About API Pagination
There are a few different ways to implement pagination in your APIs. We cover everything you need to know about API pagination.
Read more >What is the best way to implement backend pagination using ...
Use the .count() method, then: (count + documentsPerPage - 1) % documentsPerPage to make a floor-up operation on the amount of records ...
Read more >Working on the Pagination Backend in MEAN Stack - Javatpoint
1) We can easily retrieve the piece of information on the backend in our express app by accessing request. · 2) So, this...
Read more >Implement Pagination in very simple ways in API | Spring Boot
In this video we are going to implement pagination in simple ways in spring boot.We will create api based on pageNumber and pageSize....
Read more >The best database pagination technique is … | by Matej Bačo
Pagination is a strategy employed when querying any dataset that holds more than just a few hundred records. Thanks to pagination, we can...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you for the comments @Naraujo13. All make sense. I’ll try to update the PR today.
Damn. Already implemented it for projects API and created a PR 😃