ropering / Study

0 stars 0 forks source link

[TIL] 22.05.01 #43

Open ropering opened 2 years ago

ropering commented 2 years ago
from typing import Optional
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
async def read_root():
    return {"Hello": "World"}

@app.get("/items/{item_id}")
async def read_item(item_id: int, q: Optional[str] = None):
    return {"item_id": item_id, "q": q}