https://github.com/elliottlandsborough/dog-ceo-api-golang
The backend for the dog.ceo api.
https://github.com/elliottlandsborough/dog-ceo-api-golang
api aws dog dogs go golang lambda
Last synced: 6 months ago
JSON representation
The backend for the dog.ceo api.
- Host: GitHub
- URL: https://github.com/elliottlandsborough/dog-ceo-api-golang
- Owner: ElliottLandsborough
- Created: 2019-06-20T16:25:48.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-12-30T12:38:38.000Z (almost 2 years ago)
- Last Synced: 2025-03-25T17:46:56.399Z (7 months ago)
- Topics: api, aws, dog, dogs, go, golang, lambda
- Language: Go
- Homepage: https://dog.ceo/api
- Size: 92.8 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dog.ceo golang lambda functions
[](https://dl.circleci.com/status-badge/redirect/circleci/AE794oGvVf6X3TA8Q3K9s/bYUpPd4Cc9ATboVrnJhRf/tree/main)
[](https://codecov.io/gh/ElliottLandsborough/dog-ceo-api-golang)
[](https://opensource.org/licenses/MIT)
[](https://golang.org/)
[](https://aws.amazon.com/lambda/)
[](https://app.codacy.com/gh/ElliottLandsborough/dog-ceo-api-golang/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)The AWS Lambda functions used for the [dog.ceo api](https://dog.ceo/api).
[Old version in node](https://github.com/ElliottLandsborough/dog-ceo-api-node).
## Quick start
```shell
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
* AWS CLI already configured with Administrator permission
* [Docker installed](https://www.docker.com/community-edition)
* [Golang](https://golang.org)## Setup process
### Dependencies
```shell
go get ./...
```### Compiling
```shell
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**
```shell
make build && make start
```## Packaging and deployment
```shell
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:
```shell
make test
```### Example environment_variables.json
```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/"
}
}
```