/bankapi2

Primary LanguageGoGNU General Public License v2.0GPL-2.0

gopherbadger-tag-do-not-edit gopherbadger-tag-do-not-edit

Bank API

Instructions to Run

Prod

  • toDo

Local

  • Database: docker-compose up will start the PostgreSQL DB
  • make migrateup will migrate the database structure
  • go run main.go will start the api

Routes

Accounts

  • POST {{base_url}}/accounts/create - Create one account in the database
{
	Name       string    `json:"name"`
	Cpf        string    `json:"cpf"`
	Secret     string    `json:"secret"`
}
  • GET {{base_url}}/accounts/{accountID} - Get one account by ID
  • GET {{base_url}}/accounts/all - List all accounts

Transfer

  • GET {{base_url}}/transfers/{accountID} - List all transfer by account ID
  • POST {{base_url}}/transferTo - Perform a transfer between two accounts (Login Required) (QueryParams: accountID_destination, amount)

Auth

  • POST {{base_url}}/accounts/login - Authenticate the account and returns JWT token
{
	Cpf        string    `json:"cpf"`
	Secret     string    `json:"secret"`
}