- This is a Currency Conversion system implementation of the requirements described here;
- Live app is deployed on heroku here:
- accepts POST request to https://currency-converter-oef.herokuapp.com/v1/api/convert/ with json body:
{"fromCurrency": "GBP","toCurrency":"EUR","amount":100}
- responds with json body:
{"exchange":1.1689343994,"amount":116.8934399400,"original":100}
- Dependencies are defined here and plugins here;
- Rest API based on akka-http;
- For json (de)serialization jackson-scala is used;
- Testing layer uses: scala test for defining test cases, scala mock for mocking dependencies in unit tests and akka-http-test-kit for api tests;
- Plugins configured for the project are: s-coverage for code test coverage, scala-style for code style checking, scalafmt for code formatting and sbt-updates for keeping up the dependencies up to date
It's behaviour is defined by the API Integration test found here.
[info] RestApiTest:
[info] restApi should
[info] - respond with HTTP-200 OK when submitting valid currency conversions
[info] - respond with HTTP-404 Not Found for a non existing path
[info] - respond with HTTP-405 Method Not Allowed for a non supported HTTP method
[info] - respond with HTTP-400 Bad Request in case of an InvalidCurrencyException
[info] - respond with HTTP-502 Bad Gateway in case of a RatesApiException
[info] - respond with HTTP-404 Not Found in case of a CurrencyNotFoundException
[info] - respond with HTTP-500 Internal Server Error in case of a generic Exception
To run application, call:
sbt run
If you wanna restart your application without reloading of sbt, use:
sbt re-start