Project given by WEX as code challenge, a API that stores transaction and allows users to retrieve those transactions converting the value of the trasaction to the speciefied country's currency
This project is written in Golang 1.21
Gin is our HTTP Server, it handles our routing system and HTTP requests
ORM library for dealing with database connections
Helps in validating our entities and dtos
Leveled loggin library
Testing tools
The project can run through Docker or locally first will need to
-
Download this repository
git clone https://github.com/jvfrodrigues/transaction-product-wex
-
Create .env file copying .env.example
cp .env.example .env
-
Run docker compose
docker-compose -f docker-compose-prod.yaml up -d
-
Test! It should run on localhost:8080
-
If you want you can set the env variable in .env to "prd" so it will use postgres instead of sqlite
- Install all dependencies
go mod download
- Run the project
go run main.go
- Test! It should run on localhost:8080
All available routes are on the insomnia file in the repository.
Here is a list of the routes:
-
Healtcheck on GET /health
-
Create transaction on POST /transaction the body should be:
"description": "string", "transaction_date": "ISO8601 string date", "amount": "number"
-
Find transaction and convert to currency on GET /transaction/exchange/{id_to_find}?country={country_to_convert}