Volver al curso

Node.js y APIs con Express

leccion
9 / 12
beginner
10 horas
DB + features reales

Paginacion: limit, cursor y orden estable

Lectura
18 min~1 min lectura

Paginacion

Listas largas necesitan paginacion. Aprende un enfoque simple y estable para APIs.

Conceptos clave

  • limit + cursor
  • orden estable por created_at + id
  • evitar OFFSET en tablas grandes

Ejemplo

Cursor tipico: created_at + id para no perder ni duplicar items.

Ejercicio

  • Implementa GET /items?limit=20&cursor=...
  • Asegura orden estable y repetible.

Checklist de mastery

  • Puedo paginar sin OFFSET.
  • Mi API no duplica items entre paginas.