From b511177fef8913a15a7a96bf777f8865e501c190 Mon Sep 17 00:00:00 2001 From: administrator Date: Thu, 15 Feb 2024 17:06:18 +0800 Subject: [PATCH] Update app/main.py --- app/main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/main.py b/app/main.py index 6125e30..ba63c8c 100644 --- a/app/main.py +++ b/app/main.py @@ -1,9 +1,11 @@ from typing import Union -from fastapi import FastAPI +from fastapi import FastAPI, Request app = FastAPI() -@app.get("/") -def read_root(): - return {"Hello": "World - 20240202"} \ No newline at end of file + +@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} \ No newline at end of file