-
set your Google Maps API key via:
export GOOGLE_API_KEY="<INSERT KEY HERE>"
-
Run unit + integration tests and then run service
sh start.sh
-
Wait for app / db initialization. During start-up, app will wait for up to 30s for DB to be initialized.
-
Query service at
localhost:8080
e.g.curl -L -X GET \ 'http://localhost:8080/orders?page=0&limit=3' \ -H 'Content-Type: application/json'
Recommended for automatic management of database, build-args, ports, etc.
docker-compose up --build app
docker build ./app -t basic-api --build-arg GOOGLE_API_KEY=$GOOGLE_API_KEY --build-arg PORT=8080
docker run --rm -p 8080:8080 basic-api
go get
go run main.go
Migration are run automatically to latest version on app start.
To reset / drop database for testing on a clean slate, run
docker-compose down --volumes
docker-compose up tester
docker-compose run tester go test ./... -short
Alternative, for quicker debugging if local environment is configured:
cd app
go test ./... -short
First, make sure your service is running using instructions above.
curl -L -X POST \
http://localhost:8080/orders \
-H 'Content-Type: application/json' \
-d '{"origin": ["22.278", "114.185"], "destination": ["22.31", "114.212"]}'
curl -L -X PATCH \
http://localhost:8080/orders/2 \
-H 'Content-Type: application/json' \
-d '{"status": "TAKEN"}'
curl -L -X GET \
'http://localhost:8080/orders?page=0&limit=3' \
-H 'Content-Type: application/json'