You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Filter by title (case-insensitive substring match)
author
string
Filter by author name (case-insensitive substring)
year
number
Filter by exact publication year
sort
string
Sort by field + direction (e.g. year_desc, title_asc)
limit
number
Max results per page
page
number
Page number (1-indexed, default 1)
Error Handling
All errors follow a consistent JSON format:
{
"error": "Human-readable error description"
}
Status Code
Meaning
400
Validation failed
404
Resource not found
409
Duplicate / conflict
500
Internal server error
Design Decisions
In-memory storage: Data lives in JavaScript arrays — simple, no database setup required, but data is lost on restart. Suitable for learning and assessment.
Cascade deletion: Deleting an author removes all associated books to prevent orphaned references.
Centralized types: All TypeScript interfaces are defined in src/types/index.ts for consistency and maintainability.
Custom AppError class: Enables route handlers to throw structured errors with HTTP status codes, handled cleanly by the error middleware.