|
|
|
@ -145,8 +145,6 @@ There are other formats and tools to define and install package dependencies. |
|
|
|
* Create a `main.py` file with: |
|
|
|
|
|
|
|
```Python |
|
|
|
from typing import Union |
|
|
|
|
|
|
|
from fastapi import FastAPI |
|
|
|
|
|
|
|
app = FastAPI() |
|
|
|
@ -158,7 +156,7 @@ def read_root(): |
|
|
|
|
|
|
|
|
|
|
|
@app.get("/items/{item_id}") |
|
|
|
def read_item(item_id: int, q: Union[str, None] = None): |
|
|
|
def read_item(item_id: int, q: str | None = None): |
|
|
|
return {"item_id": item_id, "q": q} |
|
|
|
``` |
|
|
|
|
|
|
|
|