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
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
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"
}
}
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"
}
}
Command:
./scripts/bin.sh test
Command:
./scripts/bin.sh unit_test
Command:
./scripts/bin.sh integration_test
Command:
./scripts/bin.sh generate
Linting is the automated checking of your source code for programmatic and stylistic errors
Command:
./scripts/bin.sh lint