【FastAPI】ルートパラメータを使ってみる

必須パラメータ

from fastapi import FastAPI

app = FastAPI()

@app.get("/root-param/{name}")
async def hello(name):
    return f"hello, {name}"

http://localhost:8000/root-param/odaneko

任意パラメータ

FastAPIの仕様上、任意パラメータは存在しません。

以上になります。
お読み頂き、ありがとうございました。