diff --git a/app/main.py b/app/main.py index ce0cae8..b6fb911 100644 --- a/app/main.py +++ b/app/main.py @@ -1,29 +1,14 @@ -import uvicorn +from typing import Union + from fastapi import FastAPI -from type.response import JsonResponMsg, Msg -from type.client import UserID, User app = FastAPI() +@app.get("/") +def read_root(): + return {"Hello": "World"} -@app.get("/userID", response_model=JsonResponMsg) -async def getUserById(userID: UserID) -> JsonResponMsg: - return { - "status": 200, - "body": { - "message": f"args- {userID}", - "tag": f"args- {userID}" - } - } - -@app.post("/userID", response_model=JsonResponMsg) -async def newUserById(user: User) -> JsonResponMsg: - - return JsonResponMsg( - status= 200, - body=Msg( - message=user["name"], - tag=str(user["userId"]) - ) - ) +@app.get("/items/{item_id}") +def read_item(item_id: int, q: str = None): + return {"item_id": item_id, "q": q} \ No newline at end of file