Goal
Paginate the list endpoint so callers don't have to receive the full list.
Acceptance criteria
GET /tasks?limit=10 returns at most 10 tasks.
GET /tasks?page=2&limit=10 returns tasks 11–20 (1-indexed pages).
- Default
page=1, default limit=50 (document the choice in code).
- Out-of-range pages return an empty array, not an error.
- Reject
page=0 and limit=0 with 400 Bad Request.
- Tests cover: default page, second page, last partial page, page beyond the end.
Branch
feat/issue-3-add-pagination
Files to touch
src/handlers.rs — extract Query<Pagination>; return the slice.
src/store.rs — add a paginated(page, limit) -> Vec<&Task> helper.
tests/integration.rs — at least three new tests.
Suggested commit shape
feat: add ?page= and ?limit= pagination to GET /tasks
test: cover default, second, partial, and out-of-range pages
fix: reject page=0 and limit=0 with 400 Bad Request
Verification
cargo test — all tests pass.
cargo fmt --check && cargo clippy --all-targets -- -D warnings — clean.
See docs/issues/03-add-pagination.md for the full spec.
Goal
Paginate the list endpoint so callers don't have to receive the full list.
Acceptance criteria
GET /tasks?limit=10returns at most 10 tasks.GET /tasks?page=2&limit=10returns tasks 11–20 (1-indexed pages).page=1, defaultlimit=50(document the choice in code).page=0andlimit=0with400 Bad Request.Branch
feat/issue-3-add-paginationFiles to touch
src/handlers.rs— extractQuery<Pagination>; return the slice.src/store.rs— add apaginated(page, limit) -> Vec<&Task>helper.tests/integration.rs— at least three new tests.Suggested commit shape
feat: add ?page= and ?limit= pagination to GET /taskstest: cover default, second, partial, and out-of-range pagesfix: reject page=0 and limit=0 with 400 Bad RequestVerification
cargo test— all tests pass.cargo fmt --check && cargo clippy --all-targets -- -D warnings— clean.See
docs/issues/03-add-pagination.mdfor the full spec.