docs_src/path_operation_configuration/tutorial006_py310.py
raw| 1 | from fastapi import FastAPI |
| 2 | |
| 3 | app = FastAPI() |
| 4 | |
| 5 | |
| 6 | @app.get("/items/", tags=["items"]) |
| 7 | async def read_items(): |
| 8 | return [{"name": "Foo", "price": 42}] |
| 9 | |
| 10 | |
| 11 | @app.get("/users/", tags=["users"]) |
| 12 | async def read_users(): |
| 13 | return [{"username": "johndoe"}] |
| 14 | |
| 15 | |
| 16 | @app.get("/elements/", tags=["items"], deprecated=True) |
| 17 | async def read_elements(): |
| 18 | return [{"item_id": "Foo"}] |