docs/examples/parameters/query_params_default.py
raw| 1 | from typing import Dict |
| 2 | |
| 3 | from litestar import Litestar, get |
| 4 | from litestar.params import FromQuery |
| 5 | |
| 6 | |
| 7 | @get("/", sync_to_thread=False) |
| 8 | def index(param: FromQuery[str] = "hello") -> Dict[str, str]: |
| 9 | return {"param": param} |
| 10 | |
| 11 | |
| 12 | app = Litestar(route_handlers=[index]) |
| 13 | |
| 14 | |
| 15 | # run: / |
| 16 | # run: /?param=john |