Update app/main.py
This commit is contained in:
10
app/main.py
10
app/main.py
@@ -1,9 +1,11 @@
|
|||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI, Request
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
@app.get("/")
|
|
||||||
def read_root():
|
@app.get("/items/{item_id}")
|
||||||
return {"Hello": "World - 20240202"}
|
def read_root(item_id: str, request: Request):
|
||||||
|
client_host = request.client.host
|
||||||
|
return {"client_host": client_host, "item_id": item_id}
|
||||||
Reference in New Issue
Block a user