{"id":36483343,"url":"https://github.com/kieronlangdon/go_api_example_with_db","last_synced_at":"2026-01-12T01:05:20.182Z","repository":{"id":41960184,"uuid":"303660422","full_name":"kieronlangdon/go_api_example_with_db","owner":"kieronlangdon","description":"Go REST api example project with minikube deployment steps and postgres db","archived":false,"fork":false,"pushed_at":"2023-01-06T01:01:35.000Z","size":43,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-19T13:49:09.241Z","etag":null,"topics":["go","helm","kubernetes-deployment","minikube-setup","restapi","unit-testing","workflow-automation"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kieronlangdon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-13T10:00:21.000Z","updated_at":"2021-05-12T08:50:56.000Z","dependencies_parsed_at":"2023-02-05T01:17:01.065Z","dependency_job_id":null,"html_url":"https://github.com/kieronlangdon/go_api_example_with_db","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kieronlangdon/go_api_example_with_db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kieronlangdon%2Fgo_api_example_with_db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kieronlangdon%2Fgo_api_example_with_db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kieronlangdon%2Fgo_api_example_with_db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kieronlangdon%2Fgo_api_example_with_db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kieronlangdon","download_url":"https://codeload.github.com/kieronlangdon/go_api_example_with_db/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kieronlangdon%2Fgo_api_example_with_db/sbom","scorecard":{"id":559749,"data":{"date":"2025-08-11","repo":{"name":"github.com/kieronlangdon/go_api_example_with_db","commit":"111c5dd557a4c8fc272f672de749b3c60f47c49d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/kieronlangdon/go_api_example_with_db/go.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/kieronlangdon/go_api_example_with_db/go.yml/main?enable=pin","Warn: containerImage not pinned by hash: postgres/Dockerfile:1","Warn: containerImage not pinned by hash: postgres/Dockerfile:31","Warn: downloadThenRun not pinned by hash: .github/workflows/go.yml:32","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 containerImage dependencies pinned","Info:   2 out of   2 goCommand dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T13:19:44.105Z","repository_id":41960184,"created_at":"2025-08-20T13:19:44.105Z","updated_at":"2025-08-20T13:19:44.105Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28330222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","helm","kubernetes-deployment","minikube-setup","restapi","unit-testing","workflow-automation"],"created_at":"2026-01-12T01:05:16.326Z","updated_at":"2026-01-12T01:05:20.177Z","avatar_url":"https://github.com/kieronlangdon.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go_api_example_with_db\n\nExtending https://github.com/kieronlangdon/go_api_example with a Postgres DB\n\n Simple GO Lang REST API\n\n\u003e Simple RESTful API to create, read and delete books with a postgres DB   \nCreate/update not implemented yet!\n\n## Quick Start\n\n\n``` bash\n# Install mods\ngo get -u github.com/gorilla/mux\ngo get -u github.com/go-resty/resty\ngo get -u github.com/stretchr/testify/assert\ngo get -u github.com/stretchr/testify/suite\ngo get -u github.com/jinzhu/gorm\ngo get -u github.com/rs/cors\ngo get -u gorm.io/gorm/clause\n```\n\n``` bash\ngo build\n./go_postgres\n```\n\n## Endpoints\n\n### Get All Books\n``` bash\nGET api/books\n```\n### Get Single Book\n``` bash\nGET api/books/{id}\n```\n\n### Get All Authors and if any books \n``` bash \nGET api/authorsextra/\n```\n### Delete Book\n``` bash\nDELETE api/books/{id}\n```\n\n### Create Book\n``` bash \nPOST api/books/   \nParams =    \nisbn=12346   \ntitle=Adentures Of Mick\n```\n### Create Author\n``` bash \nPOST api/authors/   \nParams =    \nfirstname=Tony   \nlastname=O'Holohan\n```\n### Update Book\nTBC\n\n### Health probe\n``` bash\nGET healthz\n```\n\n### Readiness probe\n``` bash\nGET readyz\n```\n\n\n### Build steps\n``` bash\nSet Paths:\nexport GOPATH=/Users/$USER/go\nexport PATH=$PATH:$GOPATH/bin;\n\nFrom:\n$GOPATH/src/github.com/$USER/postgres\ndocker build -t my-go-app .\n\nEnter container using Almquist shell after starting:\ndocker run -it --rm my-go-app  /bin/ash\nRun container in detached mode\ndocker run -p 8080:8001 -d my-go-app\nRun Unit tests only\ngo test -v -run Unit\nRun tests with coverage report\ngo test -coverprofile=c.out\nSee report in browser (generates html file)\ngo tool cover -html=c.out -o coverage.html\n\n```\n### Minikube setup\n```\nminikube delete\nminikube start\neval $(minikube docker-env)\n```\n### Minikube steps for error:   \nhttps://registry-1.docker.io/v2 connection error while pulling image   \n`minikube ssh`   \n`sudo vi /etc/systemd/network/10-eth1.network` add `DNS=8.8.8.8` under [Network]   \n`sudo vi /etc/systemd/network/20-dhcp.network` add `DNS=8.8.8.8` under [Network]   \n`sudo systemctl restart systemd-networkd`    \n### Local registry steps:   \n**Start registry**   \n`docker run -d -p 5000:5000 --restart=always --name registry registry:2`   \n**Build image**   \n`docker build -t my-go-app .`   \n**Tag image**   \n`docker tag my-go-app:latest localhost:5000/my-go-app`   \n**Push to local registry**   \n`docker push localhost:5000/my-go-app`   \n**Remove image local - does not remove from registry**   \n`docker image remove localhost:5000/my-go-app`   \n### Create deployment in minikube\n`minikube kubectl create deployment testdev -- --image=localhost:5000/my-go-app`   \n\n### Alt steps for running minikube and to avoid going down a rabbit hole of nonsense   \n**Build image**   \n`docker build -t my-go-app .`   \n**Tag image**   \n`docker tag my-go-app:latest localhost:5000/my-go-app`   \n**Point your terminal to use the docker daemon inside minikube**   \n`eval $(minikube docker-env)`   \n**Check to see all images**      \n`docker images`   \nNotice that the image we just created and tagged is not here? We're using minikube's docker daemon now   \n**Push to cache in minikube**   \n`minikube cache add localhost:5000/my-go-app`   \nThis will fail as the image doesn't exist in this daemon   \nSo in another terminal OR after undoing `eval $(minikube docker-env)`   \nRe-run `minikube cache add localhost:5000/my-go-app`   \n**Check image is in minikube cache**   \n`minikube cache list`   \nWe will see an image with no repo \u0026 tag, check the imageId, it's the same as the local image in non minikube docker   \n**Tag image in minikube docker daemon**   \n`docker tag c22dbba37091 localhost:5000/my-go-app`   \n**Create deployment in minikube**   \n`minikube kubectl create deployment testdev -- --image=localhost:5000/my-go-app`  \n### Alter deployment yaml to pull from minikube local   \nGet deployment yaml   \n`minikube kubectl get deploy testdev -- -o yaml --export \u003e\u003e testdev.yaml`   \nIn testdev.yaml   \n`imagePullPolicy: Always`   \nchange to    \n`imagePullPolicy: Never`   \nApply yaml   \n`minikube kubectl apply -- -f testdev.yaml`   \n### Expose container port using service   \nSet deployment to expose deployment of type node port   \n`minikube kubectl expose deployment testdev -- --type=NodePort --port=8001`   \nGet port that has been exposed externally   \n` minikube kubectl get svc testdev`   \nGet minikube ip   \n`minikube ip`   \nTest interaction with cluster   \n`curl 192.168.50:32145/api/books`     \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkieronlangdon%2Fgo_api_example_with_db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkieronlangdon%2Fgo_api_example_with_db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkieronlangdon%2Fgo_api_example_with_db/lists"}