Skip to content

BE-4: GET Book Record #4

@tecnodeveloper

Description

@tecnodeveloper

Implement an endpoint to fetch a single book by its ID.

User Story

Given a book exists
When I request it by ID
Then I should receive that book’s details

Endpoint

GET /book/:id

Tasks

  • Create GET /book/:id route

  • Validate id param

  • Fetch book from DB

  • Handle not found case

  • Return book data

  • Add Swagger documentation

    • Define path param
    • Add responses (200, 404)

Acceptance Criteria

  • Valid ID returns 200 OK with book
  • Non-existent ID returns 404 Not Found
  • Invalid ID returns 400 Bad Request
  • Swagger UI supports testing

Testing Steps

  • Create a book

  • Copy its id

  • Send GET request:

    /book/:id
    
  • Verify response is 200 OK

  • Test with invalid/non-existent ID → expect 404

Definition of Done

  • Endpoint implemented
  • Validation handled
  • Error handling works
  • Swagger docs updated
  • Code linted and formatted

Metadata

Metadata

Labels

No labels
No labels

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions