docs/examples/onboarding/flask/status_codes.py
raw| 1 | from litestar import Litestar, Response, get |
| 2 | |
| 3 | |
| 4 | @get("/static", status_code=404, sync_to_thread=False) |
| 5 | def static_status() -> str: |
| 6 | return "not found" |
| 7 | |
| 8 | |
| 9 | @get("/dynamic", sync_to_thread=False) |
| 10 | def dynamic_status() -> Response[str]: |
| 11 | return Response("not found", status_code=404) |
| 12 | |
| 13 | |
| 14 | app = Litestar(route_handlers=[static_status, dynamic_status]) |