3 ms·
Awesome points; didn't know about the Link header (RFC5988). Regarding pagination: a few years ago I switched to using "skip" and "limit", instead of "page" an
by georgecalm 13y ago
Awesome points; didn't know about the Link header (RFC5988).
Regarding pagination: a few years ago I switched to using "skip" and "limit", instead of "page" and "per_page" or a variation of the two. Instead of thinking about pages (an abstract idea) it forces me to think about the concrete list of objects being requested from the resource, how many of those I want and how many to skip from the start; making it easier to reason about pagination (at least for me).
- veesahni 13y ago(original author here) I thought about this one when writing the post. Although I think the differences between the two are marginal, my conclusion was that it's "simpler" to increment a page number by 1 in code than incrementing by the page size.
- kbenson 13y agoDealing with pages can get trickier if you allow the user to change the number displayed per page when not on the first page. It's not particularly hard to figure out, but what the right thing to do when the boundaries don't line up is a question that needs to be answered, as well, as well as dealing with user confusion about what page they are then on. Dealing with number ranges instead of pages solves these problems, at the cost of some readability.