Skip to content

Latest commit

 

History

History
46 lines (36 loc) · 1.4 KB

README.md

File metadata and controls

46 lines (36 loc) · 1.4 KB

Java Currency converter

This is small REST-service which can convert some amount from on currency to another.

Main dependencies

#Notes about exchangeratesapi.io free plan

If you use the free plan on exchangeratesapi.io, you coundn't change base currency. And the base currency is EUR.

How to build the app

gradle shadowJar - was builded an build/libsConverterApp-fat.jar

How to run the app

At first, you need to set some environment variables:

  • EX_RATE_ACCESS_KEY - your access_key for exchangeratesapi.io (doesn't have default value)
  • EX_RATE_API_URL - the url exchangeratesapi.io (http://api.exchangeratesapi.io/v1/ as default)
  • CONVERTER_APP_PORT - port of the application (8090 as default)

Then just run the next command:

    java -jar build/libs/ConverterApp-fat.jar

How to check that converter works

    curl --request GET \
  --url 'http://localhost:8090/converter/convert?source=EUR&target=RUB&monetary=100'

The result of the request will looks like

    {
      "source": "EUR",
      "target": "RUB",
      "rate": "82.668491",
      "amountSource": "100",
      "amountResult": "8266.85"
    }