websoft9/api/main.py

15 lines
261 B
Python
Raw Normal View History

2021-08-27 10:15:17 +00:00
from typing import Optional
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: Optional[str] = None):
return {"item_id": item_id, "q": q}