AcmeExchangeR is a simple web api for exchange rates
- Api is written with
dotnet core 6 - My database choice is
postgresql(In order to make it much funnier i'm usingpostgresas document db for one tableExchangeRates)
.
├── AcmeExcangeR
│ ├── src/
│ │ ├── API/
│ │ │ ├── AcmeExcangeR.API/
│ │ │ │ ├── appsettings.json
│ │ │ │ ├── Controllers/
│ │ │ │ ├── Middlewares/
│ │ │ │ ├── Validators/
│ │ │ │ ├── ...
│ │ │ ├── AcmeExcangeR.Bus/
│ │ │ │ ├── Services/
│ │ │ ├── AcmeExcangeR.Data/
│ │ │ │ ├── Entities/
│ │ │ │ ├── ExchangeRateDbContext.cs
│ │ ├── Utils/
│ │ │ ├── AcmeExcangeR.Utils/
│ │ │ │ ├── FastForexClient/
│ │ │ │ ├── Models/
│ │ ├── Misc/
│ │ │ ├── Scripts/
│ │ │ │ ├── tables.sql
│ │ │ │ ├── Dockerfile
│ │ Readme.md
│ └── docker-compose.yaml
There is a docker-compose file in the root of the project. You can simply run docker-compose up -d
it will create a postgres and api. postgres will run at port 5432 and api will run at port 5010.
After docker-compose finishes you must see sth. like this:
Creating acmeexchanger_db_1 ... done
Creating acmeexchanger_api_1 ... done
And you can go http://localhost:5010/swagger/index.html to interact with api. Or you can use postman/curl
- Exchange rate resource is
fastforex.io - There is a background service called
RateFetcherBackgroundServiceinsideapiproject. It will fetch rates in every5seconds. (That is configurable throughappsetting.json) So i assume system is always works with fresh data. - There is a config section with key
Exchangesinappsettings.jsonwhich is the exchanges that system will fetch and restore. You can add or remove exchanges by editing that file. - I assume that all clients should send
X-Client-Idas identifier so any request without that header will getBadRequest.