Browse Source

docs: add async usage tip for clarity

pull/14524/head
Malak khoder 7 months ago
parent
commit
0c2c0561f3
  1. 9
      docs/en/docs/index.md

9
docs/en/docs/index.md

@ -8,7 +8,7 @@
<a href="https://fastapi.tiangolo.com"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" alt="FastAPI"></a> <a href="https://fastapi.tiangolo.com"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" alt="FastAPI"></a>
</p> </p>
<p align="center"> <p align="center">
<em>FastAPI framework, high performance, easy to learn, fast to code, ready for production</em> <em>FastAPI framework: high performance, easy to learn, fast to code, and ready for production</em>
</p> </p>
<p align="center"> <p align="center">
<a href="https://github.com/fastapi/fastapi/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster" target="_blank"> <a href="https://github.com/fastapi/fastapi/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster" target="_blank">
@ -123,7 +123,9 @@ The key features are:
If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be used in the terminal instead of a web API, check out <a href="https://typer.tiangolo.com/" class="external-link" target="_blank">**Typer**</a>. If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be used in the terminal instead of a web API, check out <a href="https://typer.tiangolo.com/" class="external-link" target="_blank">**Typer**</a>.
**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀 **Typer** is FastAPI's little sibling, intended to be the **FastAPI of CLIs**.
🚀
## Requirements { #requirements } ## Requirements { #requirements }
@ -175,7 +177,8 @@ def read_item(item_id: int, q: Union[str, None] = None):
<details markdown="1"> <details markdown="1">
<summary>Or use <code>async def</code>...</summary> <summary>Or use <code>async def</code>...</summary>
If your code uses `async` / `await`, use `async def`: > **Tip:** Use `async def` when performing I/O-bound operations to fully benefit from FastAPI's asynchronous performance.
```Python hl_lines="9 14" ```Python hl_lines="9 14"
from typing import Union from typing import Union

Loading…
Cancel
Save