diff --git a/test-server/README.md b/test-server/README.md index 8b57ef08..abdd2b0f 100644 --- a/test-server/README.md +++ b/test-server/README.md @@ -32,3 +32,11 @@ or `C:\> \Scripts\activate.bat` where `` is the same as `c:\path\to\ ```bash $ pip install -r requirements.txt ``` + +- Run it + +```bash +$ fastapi dev main.py +``` + +You can then access the documentation by going to [ http://localhost:8000/docs](http://localhost:8000/docs). diff --git a/test-server/main.py b/test-server/main.py new file mode 100644 index 00000000..30d4a452 --- /dev/null +++ b/test-server/main.py @@ -0,0 +1,15 @@ +from typing import Union + +from fastapi import FastAPI + +app = FastAPI() + + +@app.get("/") +def read_root(): + return {"Hello": "World"} + + +@app.get("/items/{item_id}") +def read_item(item_id: int, q: Union[str, None] = None): + return {"item_id": item_id, "q": q}