docs/examples/todo_app/create/dict.py
raw| 1 | from typing import Any, Dict, List, Union |
| 2 | |
| 3 | from litestar import Litestar, post |
| 4 | |
| 5 | TODO_LIST: List[Dict[str, Union[str, bool]]] = [] |
| 6 | |
| 7 | |
| 8 | @post("/") |
| 9 | async def add_item(data: Dict[str, Any]) -> List[Dict[str, Union[str, bool]]]: |
| 10 | TODO_LIST.append(data) |
| 11 | return TODO_LIST |
| 12 | |
| 13 | |
| 14 | app = Litestar([add_item]) |