Coder Social home page Coder Social logo

billing-be's Introduction

How to run the code locally

Make sure you have docker installed.

Clone the project:

git clone https://github.com/dchlong/billing-be.git

Update deployments/base.env file

HTTP_ADDR=:8088
DATABASE_CONFIG_DATA_SOURCE=root:change_me@tcp(localhost:3306)/billing?timeout=10s&parseTime=true
NUMBER_OF_SECONDS_IN_A_BLOCK=30

Run command:

./scripts/bin.sh run
or by Docker

Update docker-compose.local.yml file (update port)

...
    environment:
      - HTTP_ADDR=:80
      - DATABASE_CONFIG_DATA_SOURCE=root:change_me@tcp(billing_db:3306)/billing?timeout=10s&parseTime=true
    ports:
      - 8088:80
...

Run command:

./scripts/bin.sh run docker

Then open postman:

Create call history

curl --location --request PUT 'http://localhost:8088/mobile/dchlong/call' \
--header 'Content-Type: application/json' \
--data-raw '{
    "call_duration": 60000
}'

Responses

{
    "id": 8
}
{
    "error": {
        "code": "invalid_input",
        "status_code": 400,
        "message": "call_duration is a required field"
    }
}

Get bill

curl --location --request GET 'http://localhost:8088/mobile/dchlong/billing'

Responses

{
    "call_count": 5,
    "block_count": 3
}
{
    "error": {
        "code": "invalid_user_name",
        "status_code": 400,
        "message": "username must be from 1-32 characters"
    }
}

Tests

Command:

 ./scripts/bin.sh test

Unit test

Command:

 ./scripts/bin.sh unit_test

Integration test

Command:

./scripts/bin.sh integration_test

Generate mock and initialize function

Command:

 ./scripts/bin.sh generate

Linting

Linting is the automated checking of your source code for programmatic and stylistic errors

Command:

 ./scripts/bin.sh lint

billing-be's People

Contributors

longdang-tiki avatar

Watchers

 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.