Skip to content

Commit

Permalink
test functions
Browse files Browse the repository at this point in the history
  • Loading branch information
zoedsoupe committed Feb 22, 2024
1 parent 1b8df47 commit 325f0bc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export PORT=4000
export GOPATH="$HOME/go"
export CGO_ENABLED=0
export GOOS=darwin
Expand All @@ -8,3 +9,22 @@ export IP_NODE=$(hostname)
export IP_V4_ADDRESS=$(hostname)

export DATABASE_INFO="host=localhost port=5432 user=$POSTGRES_USER password=$POSTGRES_PASS dbname=rinha_dev sslmode=disable"

function transact {
args=("$@")
valor=$(printf '"valor": %d' ${args[2]})
tipo=$(printf '"tipo": "%s"' ${args[3]})
body=$(printf '{"descricao": "teste", %s, %s}' $valor $tipo)
url=$(printf 'http://localhost:%d/clientes/%d/transacoes' $PORT ${args[1]})

echo $valor
echo $tipo
echo $url

curl -s -X POST -H 'content-type: application/json' -d $body $url | jq
}

function statement {
url=$(printf http://localhost:%d/clientes/%d/extrato $PORT ${args[1]})
curl -s -H 'content-type: application/json' $url | jq
}

0 comments on commit 325f0bc

Please sign in to comment.