app
¶
A minimal FastAPI application.
Functions:
Name | Description |
---|---|
read_root |
Handles the |
read_health |
Handles the |
read_item |
Handles the |
read_root
async
¶
Handles the /
route and returns a JSON response.
Source code in src/deadnews_template_python/app.py
18 19 20 21 |
|
read_health
async
¶
Handles the /health
route and returns a JSON response.
Source code in src/deadnews_template_python/app.py
24 25 26 27 |
|
read_item
async
¶
Handles the /items/{item_id}
route and returns the corresponding value as a JSON response.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item_id
|
str
|
The ID of the item to retrieve from the ITEMS dictionary. |
required |
Returns:
Type | Description |
---|---|
dict[str, str]
|
The corresponding value from the ITEMS dictionary as a JSON response. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the item_id is not found in the ITEMS dictionary, raise an HTTPException with a status code of 404. |
Source code in src/deadnews_template_python/app.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|