mirror of
https://github.com/rjNemo/fastapi
synced 2026-06-06 10:36:39 +00:00
10 lines
260 B
Python
10 lines
260 B
Python
from fastapi import FastAPI
|
|
from starlette.requests import Request
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/items/{item_id}")
|
|
def read_root(item_id: str, request: Request):
|
|
client_host = request.client.host
|
|
return {"client_host": client_host, "item_id": item_id}
|