transactions-go

command module
v0.0.0-...-2d801e5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2021 License: MIT Imports: 7 Imported by: 0

README

Transaction

The project is a Golang REST API that uses gorilla/mux as router framework, SQLite as a database and Docker to build.

Getting started

Locally

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

Docker

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

Usage

POST /account

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"}'

GET /account/{id}

To get an account the request is:

curl -X GET 'http://localhost:8080/account/1'

POST /transaction

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}'

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL