api-server
A Go (Golang) API REST built with Gin Framework

Run locally
- Create Secret Keys
go run env.go
- Authorize google auth to read bucket file
gcloud auth application-default login
- Set Enviornment Variables
go run env.go
chmod +x ./scripts/run-locally
./scripts/run-locally
- 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
- Build
make build
docker build . -t api-rest
gcloud builds submit --region=us-west2 --config cloudbuild.yaml
- Run
docker run -p 8080:8080 api-rest
- 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