32 lines
788 B
Python
32 lines
788 B
Python
from fastapi import APIRouter, Depends, HTTPException
|
|
from core.database import fake_users_db
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/book")
|
|
async def book_handler():
|
|
"""Get book information demo endpoint"""
|
|
books = {
|
|
"1": {
|
|
"id": "1",
|
|
"title": "Demo Book 1",
|
|
"author": "John Doe",
|
|
"year": 2023
|
|
},
|
|
"2": {
|
|
"id": "2",
|
|
"title": "Demo Book 2",
|
|
"author": "Jane Smith",
|
|
"year": 2022
|
|
}
|
|
}
|
|
|
|
return {
|
|
"message": "Books retrieved successfully",
|
|
"data": list(books.values()),
|
|
"metadata": {
|
|
"total_count": len(books),
|
|
"source": "demo_books_db",
|
|
"timestamp": "2024-01-01T00:00:00Z"
|
|
}
|
|
} |