From f6824ec1759d4de2eadace65ae396b2eda1c42a4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 13:34:55 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Auto=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 97f7944754..9b734bd1af 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,13 @@ app = FastAPI() async def read_root(): return {"Hello": "World"} +#### Explanation + +- `@app.get("/")` defines an HTTP GET endpoint for the root URL (`/`) +- When a client accesses this URL, the function `read_root()` is executed +- The returned dictionary is automatically converted into a JSON response + +This shows how FastAPI maps routes directly to Python functions. @app.get("/items/{item_id}") async def read_item(item_id: int, q: str | None = None):