freecoding.school100% FREE · NO SIGNUP
Endpoint BayISSUE #17 of 45

pagination · offset · cursor · keyset

RestaVSThe 401 Bandit
Resta saysPagination splits big lists into pages — offset/limit, cursor, or keyset.

You can't return a million rows at once. Offset/limit (?offset=40&limit=20) is simple but drifts if data changes between pages. Cursor-based (?after=abc123) is stable and scales — the client passes a pointer to the last item. Keyset paginates by a sorted key. Cursor pagination is the modern default for large, changing datasets.

Power-ups you unlock

The 401 Bandit attacks — common mistakes

Boss battleCompare offset vs cursor pagination for an active social feed.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>offset: GET /feed?offset=40&amp;limit=20   (can drift)
cursor: GET /feed?after=p_8810&amp;limit=20 (stable)</pre></body></html>
▶ Open the interactive comic issue
‹ Crud · The Four Basic OpsFiltering · Sorting · Query Params ›