# ๐ฆ ๐ธ - ๐ ๐
๐ฅ ๐ ๐ ๐ธ โ๏ธ ๐ธ ๐ ๏ธ, โซ๏ธ ๐ ๐ผ ๐ ๐ ๐ช ๐ฎ ๐ ๐ ๐ ๐.
**FastAPI** ๐ ๐ช ๐งฐ ๐ ๐ ๐ธ โช ๐ง ๐ ๐ช.
/// info
๐ฅ ๐ ๐ โช๏ธโก๏ธ ๐บ, ๐ ๐ ๐ ๐บ ๐.
///
## ๐ผ ๐ ๐
โก๏ธ ๐ฌ ๐ โ๏ธ ๐ ๐ ๐ ๐:
```
.
โโโ app
โย ย โโโ __init__.py
โย ย โโโ main.py
โย ย โโโ dependencies.py
โย ย โโโ routers
โย ย โ โโโ __init__.py
โย ย โ โโโ items.py
โย ย โ โโโ users.py
โย ย โโโ internal
โย ย โโโ __init__.py
โย ย โโโ admin.py
```
/// tip
๐ค ๐ `__init__.py` ๐: 1๏ธโฃ ๐ ๐ โ๏ธ ๐.
๐ โซ๏ธโ โ ๐ญ ๐ โช๏ธโก๏ธ 1๏ธโฃ ๐ ๐ โ1๏ธโฃ.
๐ผ, `app/main.py` ๐ ๐ช โ๏ธ โธ ๐:
```
from app.routers import items
```
///
* `app` ๐ ๐ ๐. & โซ๏ธ โ๏ธ ๐ ๐ `app/__init__.py`, โซ๏ธ "๐ ๐ฆ" (๐ "๐ ๐น"): `app`.
* โซ๏ธ ๐ `app/main.py` ๐. โซ๏ธ ๐ ๐ ๐ฆ (๐ โฎ๏ธ ๐ `__init__.py`), โซ๏ธ "๐น" ๐ ๐ฆ: `app.main`.
* ๐ค `app/dependencies.py` ๐, ๐ `app/main.py`, โซ๏ธ "๐น": `app.dependencies`.
* ๐ค ๐ `app/routers/` โฎ๏ธ โ1๏ธโฃ ๐ `__init__.py`, โซ๏ธ "๐ ๐ฆ": `app.routers`.
* ๐ `app/routers/items.py` ๐ ๐ฆ, `app/routers/`,, โซ๏ธ ๐: `app.routers.items`.
* ๐ โฎ๏ธ `app/routers/users.py`, โซ๏ธ โ1๏ธโฃ ๐: `app.routers.users`.
* ๐ค ๐ `app/internal/` โฎ๏ธ โ1๏ธโฃ ๐ `__init__.py`, โซ๏ธ โ1๏ธโฃ "๐ ๐ฆ": `app.internal`.
* & ๐ `app/internal/admin.py` โ1๏ธโฃ ๐: `app.internal.admin`.
๐ ๐ ๐ โฎ๏ธ ๐ค:
```
.
โโโ app # "app" is a Python package
โย ย โโโ __init__.py # this file makes "app" a "Python package"
โย ย โโโ main.py # "main" module, e.g. import app.main
โย ย โโโ dependencies.py # "dependencies" module, e.g. import app.dependencies
โย ย โโโ routers # "routers" is a "Python subpackage"
โย ย โ โโโ __init__.py # makes "routers" a "Python subpackage"
โย ย โ โโโ items.py # "items" submodule, e.g. import app.routers.items
โย ย โ โโโ users.py # "users" submodule, e.g. import app.routers.users
โย ย โโโ internal # "internal" is a "Python subpackage"
โย ย โโโ __init__.py # makes "internal" a "Python subpackage"
โย ย โโโ admin.py # "admin" submodule, e.g. import app.internal.admin
```
## `APIRouter`
โก๏ธ ๐ฌ ๐ ๐ก ๐ ๐ฉโ๐ป ๐ `/app/routers/users.py`.
๐ ๐ โ๏ธ *โก ๐ ๏ธ* ๐ ๐ ๐ฉโ๐ป ๐ฝ โช๏ธโก๏ธ ๐ ๐, ๐ง โซ๏ธ ๐.
โ๏ธ โซ๏ธ ๐ ๐ **FastAPI** ๐ธ/๐ธ ๐ ๏ธ (โซ๏ธ ๐ ๐ "๐ ๐ฆ").
๐ ๐ช โ *โก ๐ ๏ธ* ๐ ๐น โ๏ธ `APIRouter`.
### ๐ `APIRouter`
๐ ๐ โซ๏ธ & โ "๐" ๐ ๐ ๐ ๐ โฎ๏ธ ๐ `FastAPI`:
```Python hl_lines="1 3" title="app/routers/users.py"
{!../../docs_src/bigger_applications/app/routers/users.py!}
```
### *โก ๐ ๏ธ* โฎ๏ธ `APIRouter`
& โคด๏ธ ๐ โ๏ธ โซ๏ธ ๐ฃ ๐ *โก ๐ ๏ธ*.
โ๏ธ โซ๏ธ ๐ ๐ ๐ ๐ โ๏ธ `FastAPI` ๐:
```Python hl_lines="6 11 16" title="app/routers/users.py"
{!../../docs_src/bigger_applications/app/routers/users.py!}
```
๐ ๐ช ๐ญ `APIRouter` "๐ฉ `FastAPI`" ๐.
๐ ๐ ๐ ๐โ๐ฆบ.
๐ ๐ `parameters`, `responses`, `dependencies`, `tags`, โ๏ธ.
/// tip
๐ ๐ผ, ๐ข ๐ค `router`, โ๏ธ ๐ ๐ช ๐ โซ๏ธ ๐ ๐ ๐.
///
๐ฅ ๐ ๐ ๐ `APIRouter` ๐ `FastAPI` ๐ฑ, โ๏ธ ๐ฅ, โก๏ธ โ
๐ & โ1๏ธโฃ `APIRouter`.
## ๐
๐ฅ ๐ ๐ ๐ฅ ๐ ๐ช ๐ โ๏ธ ๐ ๐ฅ ๐ธ.
๐ฅ ๐ฎ ๐ซ ๐ซ ๐ `dependencies` ๐น (`app/dependencies.py`).
๐ฅ ๐ ๐ โ๏ธ ๐
๐ โ ๐ `X-Token` ๐:
```Python hl_lines="1 4-6" title="app/dependencies.py"
{!../../docs_src/bigger_applications/app/dependencies.py!}
```
/// tip
๐ฅ โ๏ธ ๐ญ ๐ ๐ ๐ ๐ผ.
โ๏ธ ๐ฐ ๐ผ ๐ ๐ ๐ค ๐ ๐ โ๏ธ ๐ ๏ธ [๐โโ ๐](security/index.md){.internal-link target=_blank}.
///
## โ1๏ธโฃ ๐น โฎ๏ธ `APIRouter`
โก๏ธ ๐ฌ ๐ โ๏ธ ๐ ๐ก ๐ "๐ฌ" โช๏ธโก๏ธ ๐ ๐ธ ๐น `app/routers/items.py`.
๐ โ๏ธ *โก ๐ ๏ธ* :
* `/items/`
* `/items/{item_id}`
โซ๏ธ ๐ ๐ ๐ โฎ๏ธ `app/routers/users.py`.
โ๏ธ ๐ฅ ๐ ๐ & ๐ ๐ ๐.
๐ฅ ๐ญ ๐ *โก ๐ ๏ธ* ๐ ๐น โ๏ธ ๐:
* โก `prefix`: `/items`.
* `tags`: (1๏ธโฃ ๐: `items`).
* โ `responses`.
* `dependencies`: ๐ซ ๐ ๐ช ๐ `X-Token` ๐ ๐ฅ โ.
, โฉ๏ธ โ ๐ ๐ ๐ *โก ๐ ๏ธ*, ๐ฅ ๐ช ๐ฎ โซ๏ธ `APIRouter`.
```Python hl_lines="5-10 16 21" title="app/routers/items.py"
{!../../docs_src/bigger_applications/app/routers/items.py!}
```
โก ๐ *โก ๐ ๏ธ* โ๏ธ โถ๏ธ โฎ๏ธ `/`, ๐:
```Python hl_lines="1"
@router.get("/{item_id}")
async def read_item(item_id: str):
...
```
...๐ก ๐ ๐ซ ๐ ๐ `/`.
, ๐ก ๐ ๐ผ `/items`.
๐ฅ ๐ช ๐ฎ ๐ `tags` & โ `responses` ๐ ๐ โ ๐ *โก ๐ ๏ธ* ๐ ๐ ๐ป.
& ๐ฅ ๐ช ๐ฎ ๐ `dependencies` ๐ ๐ ๐ฎ ๐ *โก ๐ ๏ธ* ๐ป & ๐ ๐ ๏ธ/โ ๐ ๐จ โ ๐ซ.
/// tip
๐ ๐, ๐
๐ [๐ *โก ๐ ๏ธ ๐จโ๐จ*](dependencies/dependencies-in-path-operation-decorators.md){.internal-link target=_blank}, ๐
โโ ๐ฒ ๐ ๐ถโโ๏ธ ๐ *โก ๐ ๏ธ ๐ข*.
///
๐ ๐ ๐ ๐ฌ โก ๐:
* `/items/`
* `/items/{item_id}`
...๐ฅ ๐ฏ.
* ๐ซ ๐ โข โฎ๏ธ ๐ ๐ ๐ ๐ ๐ ๐ป `"items"`.
* ๐ซ "๐" โด๏ธ โ ๐ง ๐ ๐งพ โ๏ธ (โ๏ธ ๐).
* ๐ ๐ซ ๐ ๐ ๐ `responses`.
* ๐ ๐ซ *โก ๐ ๏ธ* ๐ โ๏ธ ๐ `dependencies` ๐ฌ/๐ ๏ธ โญ ๐ซ.
* ๐ฅ ๐ ๐ฃ ๐ ๐ฏ *โก ๐ ๏ธ*, **๐ซ ๐ ๐ ๏ธ ๐โโ๏ธ**.
* ๐ป ๐ ๐ ๏ธ ๐ฅ, โคด๏ธ [`dependencies` ๐จโ๐จ](dependencies/dependencies-in-path-operation-decorators.md){.internal-link target=_blank}, & โคด๏ธ ๐ ๐ข ๐.
* ๐ ๐ช ๐ฎ [`Security` ๐ โฎ๏ธ `scopes`](../advanced/security/oauth2-scopes.md){.internal-link target=_blank}.
/// tip
โ๏ธ `dependencies` `APIRouter` ๐ช โ๏ธ, ๐ผ, ๐ ๐ค ๐ ๐ช *โก ๐ ๏ธ*. ๐ฅ ๐ ๐ซ ๐ฎ ๐ฆ ๐ 1๏ธโฃ ๐ซ.
///
/// check
`prefix`, `tags`, `responses`, & `dependencies` ๐ข (๐ ๐ ๐ผ) โ โช๏ธโก๏ธ **FastAPI** โน ๐ โ ๐ โ.
///
### ๐ ๐
๐ ๐ ๐จโโคโ๐จ ๐น `app.routers.items`, ๐ `app/routers/items.py`.
& ๐ฅ ๐ช ๐ค ๐ ๐ข โช๏ธโก๏ธ ๐น `app.dependencies`, ๐ `app/dependencies.py`.
๐ฅ โ๏ธ โ ๐ โฎ๏ธ `..` ๐:
```Python hl_lines="3" title="app/routers/items.py"
{!../../docs_src/bigger_applications/app/routers/items.py!}
```
#### โ โ ๐ ๐ท
/// tip
๐ฅ ๐ ๐ญ ๐ โ ๐ ๐ท, ๐ฃ โญ ๐ ๐.
///
๐ โฃ `.`, ๐:
```Python
from .dependencies import get_token_header
```
๐ โ:
* โถ๏ธ ๐ ๐ฆ ๐ ๐ ๐น (๐ `app/routers/items.py`) ๐ (๐ `app/routers/`)...
* ๐ ๐น `dependencies` (๐ฝ ๐ `app/routers/dependencies.py`)...
* & โช๏ธโก๏ธ โซ๏ธ, ๐ ๐ข `get_token_header`.
โ๏ธ ๐ ๐ ๐ซ ๐, ๐ ๐ ๐ `app/dependencies.py`.
๐ญ โ ๐ ๐ฑ/๐ ๐ ๐ ๐:
---
2๏ธโฃ โฃ `..`, ๐:
```Python
from ..dependencies import get_token_header
```
โ:
* โถ๏ธ ๐ ๐ฆ ๐ ๐ ๐น (๐ `app/routers/items.py`) ๐ (๐ `app/routers/`)...
* ๐ถ ๐ช ๐ฆ (๐ `app/`)...
* & ๐ค, ๐ ๐น `dependencies` (๐ `app/dependencies.py`)...
* & โช๏ธโก๏ธ โซ๏ธ, ๐ ๐ข `get_token_header`.
๐ ๐ท โ โ ๐ถ
---
๐ ๐, ๐ฅ ๐ฅ โ๏ธ โ๏ธ 3๏ธโฃ โฃ `...`, ๐:
```Python
from ...dependencies import get_token_header
```
that ๐ โ:
* โถ๏ธ ๐ ๐ฆ ๐ ๐ ๐น (๐ `app/routers/items.py`) ๐ (๐ `app/routers/`)...
* ๐ถ ๐ช ๐ฆ (๐ `app/`)...
* โคด๏ธ ๐ถ ๐ช ๐ ๐ฆ (๐ค ๐
โโ ๐ช ๐ฆ, `app` ๐ ๐ ๐ถ)...
* & ๐ค, ๐ ๐น `dependencies` (๐ `app/dependencies.py`)...
* & โช๏ธโก๏ธ โซ๏ธ, ๐ ๐ข `get_token_header`.
๐ ๐ ๐ ๐ฆ ๐ `app/`, โฎ๏ธ ๐ฎ ๐ ๐ `__init__.py`, โ๏ธ. โ๏ธ ๐ฅ ๐ซ โ๏ธ ๐. , ๐ ๐ ๐ฎ โ ๐ ๐ผ. ๐ถ
โ๏ธ ๐ ๐ ๐ญ โ โซ๏ธ ๐ท, ๐ ๐ช โ๏ธ โ ๐ ๐ ๐ ๐ฑ ๐
โโ ๐ค โ ๐ ๐ซ. ๐ถ
### ๐ฎ ๐ `tags`, `responses`, & `dependencies`
๐ฅ ๐ซ โ ๐ก `/items` ๐ซ `tags=["items"]` ๐ *โก ๐ ๏ธ* โฉ๏ธ ๐ฅ ๐ฎ ๐ซ `APIRouter`.
โ๏ธ ๐ฅ ๐ช ๐ฎ _๐
_ `tags` ๐ ๐ โ ๐ฏ *โก ๐ ๏ธ*, & โ `responses` ๐ฏ ๐ *โก ๐ ๏ธ*:
```Python hl_lines="30-31" title="app/routers/items.py"
{!../../docs_src/bigger_applications/app/routers/items.py!}
```
/// tip
๐ ๐ โก ๐ ๏ธ ๐ โ๏ธ ๐ ๐: `["items", "custom"]`.
& โซ๏ธ ๐ โ๏ธ ๐ฏโโ๏ธ ๐จ ๐งพ, 1๏ธโฃ `404` & 1๏ธโฃ `403`.
///
## ๐ `FastAPI`
๐, โก๏ธ ๐ ๐น `app/main.py`.
๐ฅ ๐โ ๐ ๐ & โ๏ธ ๐ `FastAPI`.
๐ ๐ ๐ ๐ ๐ ๐ธ ๐ ๐ ๐ ๐ฏโโ๏ธ.
& ๐ ๐ โ ๐ ๐ ๐ ๐ฎ ๐ ๐ฏ ๐น, ๐ ๐ ๐ ๐
.
### ๐ `FastAPI`
๐ ๐ & โ `FastAPI` ๐ ๐.
& ๐ฅ ๐ช ๐ฃ [๐ ๐](dependencies/global-dependencies.md){.internal-link target=_blank} ๐ ๐ ๐ โฎ๏ธ ๐ ๐ `APIRouter`:
```Python hl_lines="1 3 7" title="app/main.py"
{!../../docs_src/bigger_applications/app/main.py!}
```
### ๐ `APIRouter`
๐ ๐ฅ ๐ ๐ ๐ ๐ โ๏ธ `APIRouter`โ:
```Python hl_lines="5" title="app/main.py"
{!../../docs_src/bigger_applications/app/main.py!}
```
๐ `app/routers/users.py` & `app/routers/items.py` ๐ ๐ ๐ ๐ ๐ ๐ฆ `app`, ๐ฅ ๐ช โ๏ธ ๐ โฃ `.` ๐ ๐ซ โ๏ธ "โ ๐".
### โ ๐ญ ๐ท
๐:
```Python
from .routers import items, users
```
โ:
* โถ๏ธ ๐ ๐ฆ ๐ ๐ ๐น (๐ `app/main.py`) ๐ (๐ `app/`)...
* ๐ ๐ฆ `routers` (๐ `app/routers/`)...
* & โช๏ธโก๏ธ โซ๏ธ, ๐ ๐ `items` (๐ `app/routers/items.py`) & `users` (๐ `app/routers/users.py`)...
๐น `items` ๐ โ๏ธ ๐ข `router` (`items.router`). ๐ ๐ 1๏ธโฃ ๐ฅ โ ๐ `app/routers/items.py`, โซ๏ธ `APIRouter` ๐.
& โคด๏ธ ๐ฅ ๐ ๐น `users`.
๐ฅ ๐ช ๐ ๐ซ ๐:
```Python
from app.routers import items, users
```
/// info
๐ฅ โฌ "โ ๐":
```Python
from .routers import items, users
```
๐ฅ โฌ "๐ ๐":
```Python
from app.routers import items, users
```
๐ก ๐
๐ ๐ ๐ฆ & ๐น, โ ๐ ๐ ๐งพ ๐ ๐น.
///
### โ ๐ ๐ฅ
๐ฅ ๐ญ ๐ `items` ๐, โฉ๏ธ ๐ญ ๐ฎ ๐ข `router`.
๐ โฉ๏ธ ๐ฅ โ๏ธ โ1๏ธโฃ ๐ข ๐ `router` ๐ `users`.
๐ฅ ๐ฅ โ๏ธ ๐ 1๏ธโฃ โฎ๏ธ ๐, ๐:
```Python
from .routers.items import router
from .routers.users import router
```
`router` โช๏ธโก๏ธ `users` ๐ ๐ 1๏ธโฃ โช๏ธโก๏ธ `items` & ๐ฅ ๐ซ๐ ๐ช โ๏ธ ๐ซ ๐ ๐ฐ.
, ๐ช โ๏ธ ๐ฏโโ๏ธ ๐ซ ๐ ๐, ๐ฅ ๐ ๐ ๐:
```Python hl_lines="5" title="app/main.py"
{!../../docs_src/bigger_applications/app/main.py!}
```
### ๐ `APIRouter`โ `users` & `items`
๐, โก๏ธ ๐ `router`โ โช๏ธโก๏ธ ๐ `users` & `items`:
```Python hl_lines="10-11" title="app/main.py"
{!../../docs_src/bigger_applications/app/main.py!}
```
/// info
`users.router` ๐ `APIRouter` ๐ ๐ `app/routers/users.py`.
& `items.router` ๐ `APIRouter` ๐ ๐ `app/routers/items.py`.
///
โฎ๏ธ `app.include_router()` ๐ฅ ๐ช ๐ฎ ๐ `APIRouter` ๐ `FastAPI` ๐ธ.
โซ๏ธ ๐ ๐ ๐ ๐ฃ โช๏ธโก๏ธ ๐ ๐ป ๐ โซ๏ธ.
/// note | ๐ก โน
โซ๏ธ ๐ ๐ค ๐ โ *โก ๐ ๏ธ* ๐ *โก ๐ ๏ธ* ๐ ๐ฃ `APIRouter`.
, โ
๐, โซ๏ธ ๐ ๐ค ๐ท ๐ฅ ๐ ๐ ๐ ๐ฑ.
///
/// check
๐ ๐ซ โ๏ธ ๐ ๐ ๐ญ ๐โ โ
๐ป.
๐ ๐ โ โฒ & ๐ ๐ด ๐จ ๐ด.
โซ๏ธ ๐ ๐ซ ๐ ๐ญ. ๐ถ
///
### ๐ `APIRouter` โฎ๏ธ ๐ `prefix`, `tags`, `responses`, & `dependencies`
๐, โก๏ธ ๐ ๐ ๐ข ๐ค ๐ `app/internal/admin.py` ๐.
โซ๏ธ ๐ `APIRouter` โฎ๏ธ ๐ก *โก ๐ ๏ธ* ๐ ๐ ๐ข ๐ฐ ๐ ๐ ๐.
๐ ๐ผ โซ๏ธ ๐ ๐ ๐
. โ๏ธ โก๏ธ ๐ฌ ๐ โฉ๏ธ โซ๏ธ ๐ฐ โฎ๏ธ ๐ ๐ ๐ข, ๐ฅ ๐ซ๐ ๐ โซ๏ธ & ๐ฎ `prefix`, `dependencies`, `tags`, โ๏ธ. ๐ `APIRouter`:
```Python hl_lines="3" title="app/internal/admin.py"
{!../../docs_src/bigger_applications/app/internal/admin.py!}
```
โ๏ธ ๐ฅ ๐ โ ๐ `prefix` ๐โ โ
`APIRouter` ๐ ๐ ๐ฎ *โก ๐ ๏ธ* โถ๏ธ โฎ๏ธ `/admin`, ๐ฅ ๐ ๐ โซ๏ธ โฎ๏ธ `dependencies` ๐ฅ โช โ๏ธ ๐ ๐, & ๐ฅ ๐ ๐ `tags` & `responses`.
๐ฅ ๐ช ๐ฃ ๐ ๐ ๐ต โ๏ธ ๐ โฎ๏ธ `APIRouter` ๐ถโโ๏ธ ๐ ๐ข `app.include_router()`:
```Python hl_lines="14-17" title="app/main.py"
{!../../docs_src/bigger_applications/app/main.py!}
```
๐ ๐, โฎ๏ธ `APIRouter` ๐ ๐ง โ, ๐ฅ ๐ช ๐ฐ ๐ ๐ `app/internal/admin.py` ๐ โฎ๏ธ ๐ ๐ ๐ข.
๐ ๐ ๐ ๐ฑ, ๐ *โก ๐ ๏ธ* โช๏ธโก๏ธ `admin` ๐น ๐ โ๏ธ:
* ๐ก `/admin`.
* ๐ `admin`.
* ๐ `get_token_header`.
* ๐จ `418`. ๐ถ
โ๏ธ ๐ ๐ ๐ด ๐ ๐ `APIRouter` ๐ ๐ฑ, ๐ซ ๐ ๐ ๐ ๐ โ๏ธ โซ๏ธ.
, ๐ผ, ๐ ๐ ๐ช โ๏ธ ๐ `APIRouter` โฎ๏ธ ๐ ๐ค ๐ฉโ๐ฌ.
### ๐ *โก ๐ ๏ธ*
๐ฅ ๐ช ๐ฎ *โก ๐ ๏ธ* ๐ `FastAPI` ๐ฑ.
๐ฅ ๐ฅ โซ๏ธ... ๐ฆ ๐ ๐ฅ ๐ช ๐คท:
```Python hl_lines="21-23" title="app/main.py"
{!../../docs_src/bigger_applications/app/main.py!}
```
& โซ๏ธ ๐ ๐ท โ, ๐ฏโโ๏ธ โฎ๏ธ ๐ ๐ *โก ๐ ๏ธ* ๐ฎ โฎ๏ธ `app.include_router()`.
/// info | ๐ถ ๐ก โน
**๐**: ๐ ๐ถ ๐ก โน ๐ ๐ ๐ฒ ๐ช **๐ถ**.
---
`APIRouter`โ ๐ซ "๐ป", ๐ซ ๐ซ ๐ฝ โช๏ธโก๏ธ ๐ ๐ธ.
๐ โฉ๏ธ ๐ฅ ๐ ๐ ๐ซ *โก ๐ ๏ธ* ๐ ๐ & ๐ฉโ๐ป ๐ข.
๐ฅ ๐ซ๐ โ ๐ซ & "๐ป" ๐ซ โก ๐, *โก ๐ ๏ธ* "๐" (๐ค-โ), ๐ซ ๐ ๐.
///
## โ
๐ง ๐ ๏ธ ๐ฉบ
๐, ๐ `uvicorn`, โ๏ธ ๐น `app.main` & ๐ข `app`:
## ๐ ๐ ๐ป ๐ ๐ฐ โฎ๏ธ ๐ `prefix`
๐ ๐ช โ๏ธ `.include_router()` ๐ ๐ฐ โฎ๏ธ *๐* ๐ป โ๏ธ ๐ ๐ก.
๐ ๐ช โ , ๐ผ, ๐ฆ ๐ ๐ ๏ธ ๐ฝ ๐ ๐ก, โ
`/api/v1` & `/api/latest`.
๐ ๐ง โ๏ธ ๐ ๐ 5๏ธโฃ๐ ๐ซ ๐ค ๐ช, โ๏ธ โซ๏ธ ๐ค ๐ผ ๐.
## ๐ `APIRouter` โ1๏ธโฃ
๐ ๐ ๐ ๐ช ๐ `APIRouter` `FastAPI` ๐ธ, ๐ ๐ช ๐ `APIRouter` โ1๏ธโฃ `APIRouter` โ๏ธ:
```Python
router.include_router(other_router)
```
โ ๐ญ ๐ โซ๏ธ โญ ๐ `router` `FastAPI` ๐ฑ, ๐ *โก ๐ ๏ธ* โช๏ธโก๏ธ `other_router` ๐.