DEV Community

Fiyinfoluwa Ojo
Fiyinfoluwa Ojo

Posted on

Capstone Day 4: Polishing the To-Do App : Filtering, Pagination & Full Documentation

Day 4 — Making It Production Ready

The API works. Now let's make it excellent.
Today I added priority levels, filtering,
pagination and full Swagger documentation.

New Features

Priority Levels

Tasks now have 3 priority levels:

  • low
  • medium
  • high

Filtering

GET /tasks?priority=high -> only high priority tasks
GET /tasks?completed=false -> only incomplete tasks
GET /tasks?priority=high&completed=false -> combined!

Pagination

GET /tasks?page=1&limit=5 -> first 5 tasks

Response includes metadata:

{
  "metadata": {
    "total": 10,
    "page": 1,
    "limit": 5,
    "totalPages": 2
  },
  "data": [...]
}

Enter fullscreen mode Exit fullscreen mode

Full Swagger Documentation

Every endpoint tagged, summarized and described.
Available at /docs — zero extra work needed.

Postman Tests

Filter by priority

high priority

Filter incomplete tasks

Incomplete tasks

Swagger docs

swagger docs

What the Final API Looks Like

Method Endpoint Auth Description
GET / No API info
GET /status No Health check
POST /auth/signup No Register
POST /auth/login No Login
GET /tasks Yes Get tasks
POST /tasks Yes Create task
PUT /tasks/:id Yes Update task
DELETE /tasks/:id Yes Delete task

Lessons Learned

The difference between a working API and a
great API is the details : filtering, pagination,
documentation and consistent error handling.
These are what separate junior from senior work.

Day 29 done. 1 more to go. 🔥

GDGoCBowen30dayChallenge

Top comments (0)