Categorygithub.com/bradford-hamilton/slice-it-api
repository
0.0.0-20220908224107-61649fe157df
Repository: https://github.com/bradford-hamilton/slice-it-api.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

sliced piece of pie

Welcome to the Slice It API 👋

Using go version 1.14 Using go version 1.14 Go Report Card godoc License: MIT

Dependencies

  • Be sure to have Go (1.14+)
  • Be sure to have postgres running locally

Database

  • Set up development db with
    createdb slice_it_api_dev
    
  • Run migration:
    psql -U slice_it_user -d slice_it_api_dev -a -f internal/storage/migrations/schema.sql
    

Usage

Development

go run cmd/server/main.go

Testing

Standard:

go test ./...

For some nice color output:

make test

Deployment

Build docker image after code changes:

docker build \
  --build-arg SLICE_IT_API_SERVER_PORT={server_port} \
  --build-arg SLICE_IT_API_DB_HOST={host} \
  --build-arg SLICE_IT_API_DB_PORT={db_port} \
  --build-arg SLICE_IT_API_DB_USER={db_username} \
  --build-arg SLICE_IT_API_DB_PASSWORD={db_password} \
  --build-arg SLICE_IT_API_DB_NAME={db_name} \
  --build-arg SLICE_IT_API_SSL_MODE={ssl_mode} \
  -t bradfordhamilton/slice-it-api:latest .

Push image:

docker push bradfordhamilton/slice-it-api:latest

Then cd into build/terraform and run the following commands.

terraform plan -out=tfplan -input=false .
terraform apply -input=false tfplan