These simple microservices enable us to focus on learning the tools - Docker, Kubernetes, CI, CD and build the infrastructure needed around typical microservices.
If you ask it the value of 1 USD in BYN the Currency Exchange Service answers
- 1 USD is 2.495 BYN
http://localhost:3000/currency-exchange/from/USD/to/BYN
{
"id": 10002,
"from": "USD",
"to": "BYN",
"conversionMultiple": 2.495
}
Currency Conversion Service is used to convert a bucket of currencies.
- STEP 1 : Currency Conversion Service calls the Currency Exchange Service for the value of 1 USD. It gets a response back saying 2.495.
- STEP 2 : The Currency Conversion Service then multiplies 10 by 60, and returns 24.95 back.
http://localhost:3100/api/currency-conversion/from/EUR/to/BYN/quantity/10
{
"id": 10002,
"from": "USD",
"to": "BYN",
"conversionMultiple": 2.495,
"quantity": 10,
"totalCalculatedAmount": 24.95
}
- You don't want to HARDCODE
- Configure an Environment Variable -
CURRENCY_EXCHANGE_SERVICE_HOST
- --env CURRENCY_EXCHANGE_SERVICE_HOST=http://currency-exchange:3000
docker-compose up --no-start
docker-compose start
docker-compose stop