This is an application to match people who need just one shoe or different sized shoes to their opposite.
- Install dependencies with
go get .
- Build the API binary with
go build service.go
this will output a binary calledservice
- Set an environment variable called SQL_DATASOURCE_NAME with the value
host=sole-mates dbname=sole-mates user=user password=password sslmode=disable
- You can find the username and password for the sole-mates db in 1Password
- Run the service with
./service
. You can now access the API atlocalhost:3000
- Create the following
launch.json
file in the.vscode
folder in the root of your project (replace username and password):{ "version": "0.2.0", "configurations": [ { "name": "API", "type": "go", "request": "launch", "mode": "exec", "program": "${workspaceRoot}/service", "env": { "SQL_DATASOURCE_NAME": "host=sole-mates dbname=sole-mates user=user password=password sslmode=disable" }, "args": ["service"], "preLaunchTask": "buildAPI" } ] }
- Create the following
tasks.json
file in the.vscode
folder in the root of your project:{ "version": "2.0.0", "tasks": [ { "label": "buildAPI", "type": "shell", "command": "go build service.go", } ] }
- You can now debug locally using the debug tab in VS Code.
- Install the Google Cloud SDK
- On
gcloud init
choosesole-mates-273421
as the project
You can connect to the database in one of two ways.
- Log into console.cloud.google.com, go to SQL, find the sole-mates database and connect using the Cloud Shell
- Find the client-cert, client-key and server-ca files in 1Password and use them to set up an SSL connection with a client such as PgAdmin. Hostname, port, and username can all be found in the cloud console.