Skip to content

Atsur/api-server

Repository files navigation

api-server

A Go (Golang) API REST built with Gin Framework

Go Report Card Open Source Love Build Status

Run locally

  1. Create Secret Keys
go run env.go
  1. Authorize google auth to read bucket file
gcloud auth application-default login
  1. Set Enviornment Variables
go run env.go
chmod +x ./scripts/run-locally
./scripts/run-locally
  1. Run Locally
go run env.go
./scripts/run-locally

-- Format codebase

gofmt -s -w .

Possible Errors

  • oauth2: "invalid_grant" "Account has been deleted" error -- Check google service account and make sure secretes manager accessor permission has been explicitly added to the service account --

1. Run with Docker

  1. Build
make build
docker build . -t api-rest
gcloud builds submit --region=us-west2 --config cloudbuild.yaml   
  1. Run
docker run -p 8080:8080 api-rest
  1. Test
go test -v ./test/...

2. Generate Docs

# Get swag
go get -u github.com/swaggo/swag/cmd/swag

# Generate docs
swag init --dir cmd/api --parseDependency --output docs

Run and go to http://localhost:8080/docs/index.html

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages