Giter Site home page Giter Site logo

bank-fake-api's Introduction

🚀 API de transação bancária para estudos (AdonisJS + Mysql + Graphql + Sqlite + Docker + Testes)

Setup

git clone https://github.com/STO11/bank-fake-api.git
cd bank-fake-api
  • Copie .env.example para .env (crie esse arquivo) ou:
cp .env.example .env
  • Para utilizar a api suba as containers docker:
docker-compose up -d

Utilização

  • Após subir a container deve-se aguardar os scripts de configuração automatica e o run das migrations, após isso acessar o link http://127.0.0.1:3333 e aparecerá a mensagem no browser {"greeting":"Working!!"}

  • Utilize o seguinte endpoint para as requests http://127.0.0.1:3333/bank

  • Para você criar uma nova conta utilize o seguinte:

mutation {
    createAccount(username: "User Name", number: 4658629, email: "[email protected]", password: "123456") {
      id
      username
      email,
      accounts {
        number
      }
    }
}

  • Para você ver todas as contas:

query {
    allAccounts {
      id
      number
      balance
      user {
        id
        username
        email
      }
    }
}

  • Para você ver o saldo da sua conta:

query {
    balance(conta: 4658629) {
      id
      balance
      user {
        username
      }
    }
}

  • Para você sacar da sua conta:

mutation {
    withdraw(conta: 4658629, valor: 100) {
      id
      number
      balance,
      user {
        username
      }
    }
}

  • Para você depositar em sua conta:

mutation {
    deposit(conta: 4658629, valor: 100.30) {
      id
      number
      balance,
      user {
        username
      }
    }
}

  • Para rodar os testes você necessita entrar na container:

docker exec -it bank-nodejs /bin/bash

e rodar o comando (ele ira executar os testes no sqlite em /database/bank.sqlite rodará as migrations e excluirá logo em seguida)

adonis test

bank-fake-api's People

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.