Example of how to deploy microservices with FastAPI, PostgreSQL, docker-compose.
1) Clone repository and deploy all services with one command below.
git clone https://github.com/q00Dree/fastapi-based-microservices.git \
&& cd fastapi-based-microservices \
&& cd deploy \
&& bash deploy.sh
2) Check APIs documentation provided by Swagger OpenAPI.
curl -X 'GET' \
'http://localhost:8080/api/v1/movies/docs' \
-H 'accept: application/json'
curl -X 'GET' \
'http://localhost:8080/api/v1/casts/docs' \
-H 'accept: application/json'
curl -X 'POST' \
'http://localhost:8080/api/v1/casts/' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "Samuel Jackson",
"nationality": "USA"
}'
curl -X 'POST' \
'http://localhost:8080/api/v1/movies/' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "Pulp Fiction",
"plot": "Tarantino's best plot ever.",
"genres": ["Comedy","Neo-noir","Crime"],
"casts_id": [1]
}'
curl -X 'GET' \
'http://localhost:8080/api/v1/movies/' \
-H 'accept: application/json'
Find and show info about casts by given id.
curl -X 'GET' \
'http://localhost:8080/api/v1/casts/1/' \
-H 'accept: application/json'
Find and show info about movies by given id.
curl -X 'GET' \
'http://localhost:8080/api/v1/movies/1/' \
-H 'accept: application/json'
Update movies by given id and data in the body.
curl -X 'PUT' \
'http://localhost:8080/api/v1/movies/' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "Pulp Fiction.",
"plot": "Tarantino's best plot ever. No need to film second part.",
"genres": ["Comedy","Neo-noir","Crime"],
"casts_id": [1]
}'
Delete movies by given id.
curl -X 'DELETE' \
'http://localhost:8080/api/v1/movies/1' \
-H 'accept: application/json'