mirror of
https://github.com/fastapi/fastapi.git
synced 2026-05-30 19:29:24 -04:00
14 lines
276 B
Python
14 lines
276 B
Python
from fastapi import APIRouter
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/")
|
|
async def read_items():
|
|
return [{"name": "Item Foo"}, {"name": "item Bar"}]
|
|
|
|
|
|
@router.get("/{item_id}")
|
|
async def read_item(item_id: str):
|
|
return {"name": "Fake Specific Item", "item_id": item_id}
|