- Go Bank Transfer is a simple API for some banking routines, such as creating accounts, listing accounts, listing balance for a specific account, transfers between accounts and listing transfers.
- This is an attempt to implement a clean architecture, in case you don’t know it yet, here’s a reference https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
- Docker
- Docker-compose
- Environment variables
make init
- Starting API in development mode
make up
- Run tests in container
make test
- Run tests local (it is necessary to have golang installed)
make test-local
- Run coverage report
make test-report
make test-report-func
- View logs
make logs
Endpoint | HTTP Method | Description |
---|---|---|
/v1/accounts |
POST |
Create accounts |
/v1/accounts |
GET |
List accounts |
/v1/accounts/{{account_id}}/balance |
GET |
Find balance account |
/v1/transfers |
POST |
Create transfer |
/v1/transfers |
GET |
List transfers |
/v1/health |
GET |
Health check |
Request
curl -i --request POST 'http://localhost:3001/v1/accounts' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Test",
"cpf": "070.910.584-24",
"balance": 100
}'
Response
{
"id":"5cf59c6c-0047-4b13-a118-65878313e329",
"name":"Test",
"cpf":"070.910.584-24",
"balance":1,
"created_at":"2020-11-02T14:50:46Z"
}
Request
curl -i --request GET 'http://localhost:3001/v1/accounts'
Response
[
{
"id": "5cf59c6c-0047-4b13-a118-65878313e329",
"name": "Test",
"cpf": "070.910.584-24",
"balance": 1,
"created_at": "2020-11-02T14:50:46Z"
}
]
Request
curl -i --request GET 'http://localhost:3001/v1/accounts/{{account_id}}/balance'
Response
{
"balance": 1
}
Request
curl -i --request POST 'http://localhost:3001/v1/transfers' \
--header 'Content-Type: application/json' \
--data-raw '{
"account_origin_id": "{{account_id}}",
"account_destination_id": "{{account_id}}",
"amount": 100
}'
Response
{
"id": "b51cd6c7-a55c-491e-9140-91903fe66fa9",
"account_origin_id": "{{account_id}}",
"account_destination_id": "{{account_id}}",
"amount": 1,
"created_at": "2020-11-02T14:57:35Z"
}
Request
curl -i --request GET 'http://localhost:3001/v1/transfers'
Response
[
{
"id": "b51cd6c7-a55c-491e-9140-91903fe66fa9",
"account_origin_id": "{{account_id}}",
"account_destination_id": "{{account_id}}",
"amount": 1,
"created_at": "2020-11-02T14:57:35Z"
}
]
- Gitflow
- Development
- Gabriel Sabadini Facina - GSabadini