28 lines
667 B
Python
28 lines
667 B
Python
from fastapi import APIRouter, status
|
|
from typing import List, Dict
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/books", status_code=status.HTTP_200_OK, response_model=List[Dict])
|
|
async def get_books():
|
|
books = [
|
|
{
|
|
"id": 1,
|
|
"title": "The Great Gatsby",
|
|
"author": "F. Scott Fitzgerald",
|
|
"year": 1925
|
|
},
|
|
{
|
|
"id": 2,
|
|
"title": "To Kill a Mockingbird",
|
|
"author": "Harper Lee",
|
|
"year": 1960
|
|
},
|
|
{
|
|
"id": 3,
|
|
"title": "1984",
|
|
"author": "George Orwell",
|
|
"year": 1949
|
|
}
|
|
]
|
|
return books |