Sample program to build MySQL and Fast API environment with DockerCompose
Create and Running
$ docker-compose up -d --build
You can try GET, POST, PUT
$ curl -X GET "http://localhost:8000/users" -H "accept: application/json"
Result
[{"id":1,"age":15,"name":"太郎"},{"id":2,"age":18,"name":"次郎"},{"id":3,"age":20,"name":"花子"}]
$ curl -X POST "http://localhost:8000/user?name=士郎&age=10" -H "accept: application/json"
Result
[{"id":1,"age":15,"name":"太郎"},{"id":2,"age":18,"name":"次郎"},{"id":3,"age":20,"name":"花子"},{"id":4,"age":10,"name":"士郎"}]
$ curl -X PUT "http://localhost:8000/users" -H "accept: application/json" -H "Content-Type: application/json" -d "[{\"id\":2,\"name\":\"次郎\",\"age\":13}]"
Result
[{"id":1,"age":15,"name":"太郎"},{"id":2,"age":13,"name":"次郎"},{"id":3,"age":20,"name":"花子"},{"id":4,"age":10,"name":"士郎"}]