Coder Social home page Coder Social logo

go-transactions's Introduction

Go Transactions

This project is an API using the Go programming language.

Requires

Nice to know

Get started

The essential commands are provided from the Makefile.

To run the project tests you can use the command test. For example:

make test

So to run the project in localhost as a development mode you can use the command start

make start

The start will up the http server in your machine in localhost:3000

Other make commands

  • make build - build the image docker
  • make lint - runs Go linters
  • make bash - open the container bash
  • make restart - restart the docker compose and containers
  • make stop - stop the containers
  • make clean - stop containers and clean the environment
  • make logs [tail=50] - show the logs (tail is optional, the default value is 100)

How to use

This chapter show about how to use the API interface. We'll use the curl tool to show the examples.

Create a new account

Send a request to /accounts with the POST verb.

For example:

curl -X POST \
  localhost:3000/accounts \
  -d '{
    "account_id": 1,
    "document_number": "12345678900",
    "available_credit_limit": 1000
  }'

Response:

{
  "account_id": "1",
  "document_number": "12345678900",
  "available_credit_limit": 1000
}

Get account informations

Send a request to /accounts/:accountId with the GET verb, passing the accountId as account identifier.

For example:

curl localhost:3000/accounts/1

Response:

{
  "account_id": 1,
  "document_number": "12345678900",
  "available_credit_limit": 1000
}

Register a new transaction

Send a request to /transactions with the POST verb.

For example:

curl -X POST \
  localhost:3000/transactions \
  -d '{
    "account_id": 1,
    "operation_type_id": 4,
    "amount": 123.45
  }'

Get all transactions

Send a request to /transactions with the GET verb.

For example:

curl localhost:3000/transactions

go-transactions's People

Contributors

rafaelmateusnw avatar rafaelbmateus avatar

Stargazers

Rui Richard Blaese avatar Felipe Moura avatar Keidi Nienkotter avatar  avatar Alison Vargas avatar Guilherme Siani avatar João Maia avatar

Watchers

 avatar Rui Richard Blaese avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.