It's an API Challenge based on Zan Franceschi's Twitter post.
The main purpose of this API is to have an endpoint receiving a currency parameter and returning the best exchange value obtained from three different sources. Every source is different and has its own way of processing the server request.
- Exchange A: returns the value immediately;
- Exchange B: has a delay before return the value;
- Exchange C: has an asynchronous endpoint and send the value by a webhook.
Here is the original repository containing all requirements, some suggestions and another solutions (including another languages such as Dart and Kotlin).
I tried to use this challenge to practice some concepts, including automated tests and clean architecture. It's not the best reference for these subjects, althought it has managed to achieve my goals.
This API was developed using:
- Node
- Express
- Axios (to make requests)
- Jest (for testing)
- Node Events (to handle one of the async exchange services)
- Docker and Docker Compose
git clone git@github.com:lucas-barbosa/currency-exchange.git
cd currency-exchange
docker-compose up
It's the endpoint responsible for returning the best exchange value given a currency. You can make a request using your browser or any other tool, like curl, postman, insomnia and etc.
GET http://localhost:5000/cotacoes/:currency # currency can be BRL, USD, EUR and etc