Skip to content

BE-6: Get All Books #6

@tecnodeveloper

Description

@tecnodeveloper

Implement an endpoint to fetch all book records from the database.

User Story

Given books exist in the database
When I request all books
Then I should receive a list of books

Endpoint

GET /books

Tasks

  • Create GET /books route

  • Create controller for fetching books

  • Fetch all records from books table

  • Handle empty state (return empty array)

  • Return response with list of books

  • Add Swagger documentation

    • Define endpoint
    • Add response schema (array of books)

Acceptance Criteria

  • Endpoint returns 200 OK
  • Response contains array of books
  • Empty DB returns []
  • Swagger UI supports testing

Testing Steps

  • Ensure at least one book exists

  • Send GET request to /books

  • Verify response is 200 OK

  • Confirm response is an array

  • Match data with DB:

    SELECT * FROM books;

Definition of Done

  • Endpoint implemented
  • Data fetched correctly
  • 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