24 lines
792 B
Python
24 lines
792 B
Python
from fastapi import APIRouter, Depends, HTTPException
|
|
from core.database import fake_users_db
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/books")
|
|
async def get_books():
|
|
"""Get list of demo books"""
|
|
books = [
|
|
{"id": 1, "title": "The Great Gatsby", "author": "F. Scott Fitzgerald"},
|
|
{"id": 2, "title": "To Kill a Mockingbird", "author": "Harper Lee"},
|
|
{"id": 3, "title": "1984", "author": "George Orwell"},
|
|
{"id": 4, "title": "Pride and Prejudice", "author": "Jane Austen"},
|
|
{"id": 5, "title": "The Catcher in the Rye", "author": "J.D. Salinger"}
|
|
]
|
|
|
|
return {
|
|
"message": "Books retrieved successfully",
|
|
"data": books,
|
|
"metadata": {
|
|
"total_count": len(books),
|
|
"source": "demo_db"
|
|
}
|
|
} |