Skip to content

ElliottLandsborough/dog-ceo-api-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dog.ceo golang lambda functions

CircleCI codecov License: MIT Go AWS Lambda Codacy Badge

The AWS Lambda functions used for the dog.ceo api.

Old version in node.

Quick start

go get -u github.com/ElliottLandsborough/dog-ceo-api-golang
cd $GOPATH/src/github.com/ElliottLandsborough/dog-ceo-api-golang
make deps
make clean
make build
make start

Requirements

Setup process

Dependencies

go get ./...

Compiling

make

NOTE: If you're not building the function on a Linux machine, you will need to specify the GOOS and GOARCH environment variables, this allows Golang to build your function for another system architecture and ensure compatibility.

Local development

Invoking function locally through local API Gateway

make build && make start

Packaging and deployment

make deploy
-- OR --
make ENVIRONMENT=production deploy

Testing

We use testing package that is built-in in Golang and you can simply run the following command to run our tests:

make test

Example environment_variables.json

{
  "listAllBreeds": {
    "IMAGE_BUCKET_NAME": "dog-ceo-stanford-files",
    "FILE_BUCKET_NAME": "dog-ceo-api-static-content-dev",
    "BUCKET_REGION": "eu-west-1",
    "CDN_DOMAIN_PREFIX": "https://images.dog.ceo/breeds/"
  },
  "listBreeds": {
    "IMAGE_BUCKET_NAME": "dog-ceo-stanford-files",
    "FILE_BUCKET_NAME": "dog-ceo-api-static-content-dev",
    "BUCKET_REGION": "eu-west-1",
    "CDN_DOMAIN_PREFIX": "https://images.dog.ceo/breeds/"
  }
}