diff --git a/main.py b/main.py new file mode 100644 index 0000000..f38c360 --- /dev/null +++ b/main.py @@ -0,0 +1,25 @@ +from typing import Union +from fastapi import FastAPI + +app = FastAPI() + + +class Item: + name: str + price: float + is_offer: Union[bool, None] = None + + +@app.get("/") +async def read_root(): + return {"Hello": "World"} + + +@app.get("/items/{item_id}") +async def read_item(item_id: int, q: Union[str, None] = None): + return {"item_id": item_id, "q": q} + + +# @app.put("/items/{item_id}") +# async def update_item(item_id: int, item: Item): +# return {"item_name": item.name, "item_id": item_id} diff --git a/test.py b/test.py index 1052091..ad843c7 100644 --- a/test.py +++ b/test.py @@ -22,9 +22,9 @@ engine = create_engine( if not database_exists(engine.url): create_database(engine.url) -else: - drop_database(engine.url) - create_database(engine.url) + # else: + # drop_database(engine.url) + # create_database(engine.url) print(database_exists(engine.url))