FastAPI
OpenAPIの3.02
openapi_version: The version of the OpenAPI specification used. By default, the latest: 3.0.2.
Extending OpenAPI - FastAPI
Flaskから乗り換え検討
tiangolo/fastapi: FastAPI framework, high performance, easy to learn, fast to code, ready for production
運用は、Gunicornを想定
非同期処理が簡単に掛けるので、slackなど chat関連の問い合わせAPIとしても相性がよさそう。
FastAPIで非同期処理に対応したLINEBOTを開発する - Qiita
Hypercornというのもあるらしい: 軽量でWebAPIに特化したPythonフレームワーク「FastAPI」 - AGEST Engineers Blog
公式ではUvicornを使っていますが、HTTP/2に対応している Hypercorn を使います
Databaseとの連携は、
【調査メモ】FastAPIとデータベースの連携方法|tknm|note
日本語訳もある。
FastAPI
基本的に、Flaskで運用していたスタイルでそのままいけそうなイメージがある。
FastAPI Dependencies
4 Useful Advanced Features in FastAPI | by Ng Wai Foong | Level Up Coding
request,
@app.on_event(,
from pydantic import BaseSettings.....class Settings(BaseSettings):
@lru_cache()でconfig.settings() して、depends()で