Skip to content
Ameen Abozaid
Planned lessonJNR-019-L08

Demo: safe pagination and sorting

  • Lesson 8 of 8
  • Junior
On This Lesson 3 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

add capped paging and allow-listed sorting to the product list. Prepares JNR-019-LAB1.

Draft outline details

Step by step

  1. Add page, size, and sort parameters with defaults to GET /products.
  2. Cap size at 100 and clamp page to 0 or more.
  3. Add the sort allow-list with a tie-breaker on id.
  4. Planned mistake: ?sort=password (or any unknown field) is accepted and crashes. Fix: reject with 400.
  5. Return items plus page metadata and test with size=1000 and a bad sort field.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Type to search levels, phases, modules and lessons.