websoft9/api/main.py
chendelin1982 42b1602754 create
2021-08-27 18:15:17 +08:00

15 lines
No EOL
261 B
Python

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}