question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement Pagination on the Backend

See original GitHub issue

We 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:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mushketykcommented, Apr 30, 2020

Thank you for the comments @Naraujo13. All make sense. I’ll try to update the PR today.

1reaction
mushketykcommented, Apr 29, 2020

Damn. Already implemented it for projects API and created a PR 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found