The project is a Golang REST API that uses gorilla/mux as router framework, SQLite as a database and Docker to build.
To run project locally you need to export the environment variable PORT=:8000
or to other port to your choise and you must have installed:
- Golang >=1.16
- SQLite3
make run-local
make run-tests
make build
make docker-image
make docker-run
or just
make docker-up
The default PORT to test via Docker is 8080
to run tests on Docker:
make docker-tests
The body request to create an account is:
{
"document_number": "70620459000173"
}
The request is:
curl -X POST 'http://localhost:8080/account' -H 'Content-Type: application/json' --data-raw '{
"document_number": "70620459000173"}'
To get an account the request is:
curl -X GET 'http://localhost:8080/account/1'
The body request to create a transaction is:
{
"account_id": 1,
"operation_type_id": 4,
"amount": 600.45
}
The request is:
curl -X POST 'http://localhost:8080/transaction' -H 'Content-Type: application/json' --data-raw '{
"account_id": 1,
"operation_type_id": 4,
"amount": 600.45}'