FastAPI + Dependency Injector code samples
poetry install
This sample WebAPI returns whether the input string is included in the predefined string list (["alice", "bob", "charlie"]
).
task fastapi
$ curl -s "http://localhost:8000/?word=alice"
{"is_ok":true}
$ curl -s "http://localhost:8000/?word=xxxxx"
{"is_ok":false}
PS> Invoke-RestMethod http://localhost:8000/ -Body @{"word"="alice"}
is_ok
-----
True
PS> Invoke-RestMethod http://localhost:8000/ -Body @{"word"="xxxxx"}
is_ok
-----
False
task test
task flake8
task mypy