docs/examples/todo_app/get_list/dict.py
raw| 1 | from typing import Dict, List, Union |
| 2 | |
| 3 | from litestar import Litestar, get |
| 4 | |
| 5 | TODO_LIST: List[Dict[str, Union[str, bool]]] = [ |
| 6 | {"title": "Start writing TODO list", "done": True}, |
| 7 | {"title": "???", "done": False}, |
| 8 | {"title": "Profit", "done": False}, |
| 9 | ] |
| 10 | |
| 11 | |
| 12 | @get("/") |
| 13 | async def get_list() -> List[Dict[str, Union[str, bool]]]: |
| 14 | return TODO_LIST |
| 15 | |
| 16 | |
| 17 | app = Litestar([get_list]) |