{"id":15020043,"url":"https://github.com/afaguilarr/go-example-webserver","last_synced_at":"2025-10-24T22:32:09.937Z","repository":{"id":43807545,"uuid":"420746580","full_name":"afaguilarr/go-example-webserver","owner":"afaguilarr","description":"Example Web API built using Go, NGINX, Python (for testing), and probably React in the future","archived":false,"fork":false,"pushed_at":"2023-04-06T07:02:37.000Z","size":35652,"stargazers_count":3,"open_issues_count":11,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-07T03:51:14.396Z","etag":null,"topics":["circleci","dependabot","docker","docker-compose","gherkin","go","grpc","http","nginx","postgresql","pytest","pytest-bdd","shell-scripts"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/afaguilarr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-24T17:13:25.000Z","updated_at":"2024-01-12T18:23:41.000Z","dependencies_parsed_at":"2024-06-20T16:38:44.194Z","dependency_job_id":null,"html_url":"https://github.com/afaguilarr/go-example-webserver","commit_stats":{"total_commits":148,"total_committers":5,"mean_commits":29.6,"dds":0.472972972972973,"last_synced_commit":"817868a2e20e9edd74b9779beb79796c94c10c05"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/afaguilarr/go-example-webserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afaguilarr%2Fgo-example-webserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afaguilarr%2Fgo-example-webserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afaguilarr%2Fgo-example-webserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afaguilarr%2Fgo-example-webserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afaguilarr","download_url":"https://codeload.github.com/afaguilarr/go-example-webserver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afaguilarr%2Fgo-example-webserver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280878369,"owners_count":26406641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["circleci","dependabot","docker","docker-compose","gherkin","go","grpc","http","nginx","postgresql","pytest","pytest-bdd","shell-scripts"],"created_at":"2024-09-24T19:54:30.458Z","updated_at":"2025-10-24T22:32:04.923Z","avatar_url":"https://github.com/afaguilarr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README.md\n\n## Description\n\nThis project aims to create an example go/golang web-server.\nThe `go-example-webserver/docs` directory includes the explanation of the application being built (the docs will have a broader scope than the actual code at the point you're reading this probably).\nAny feedback is welcome since this is a public project.\n\n## Building and running the project\n\nThe project is integrated with docker, then running the following commands after setting up a `.env` file at `go-example-webserver/.env`, should be enough (there is an example env file in the root directory):\n```bash\ndocker-compose build\ndocker-compose --env-file ./.env up\ndocker-compose --env-file ./.env up -d # if you want to run the containers in the background\n```\n\n## Functional tests and Manual tests\n\nTo run the functional tests written in python, or any manual tests, we have to set up the DB, in order to do that, execute the following goose command:\n```bash\ndocker-compose run webserver sh bin/goose_apply_migrations.sh ${POSTGRES_USERNAME} ${POSTGRES_PASSWORD}\n```\nAnd then just run:\n```bash\ndocker-compose run python_tests pytest\n```\n\n## Go Unit tests\n\nTo run the unit tests:\n```bash\ndocker-compose run go_builder sh bin/go_test.sh\n```\nThis will generate a coverage report at `./app/src/report/coverage.html`.\n\n## Go linting\n\nWe have some different commands to run Go linters, run the following commands:\n```bash\ndocker-compose run go_builder sh bin/go_fmt.sh\ndocker-compose run go_builder sh bin/go_vet.sh\ndocker-compose run go_builder sh bin/staticcheck.sh\n```\n\n## Python linting\n\nTo run pylint use the following command:\n```bash\ndocker-compose run python_tests sh bin/pylint.sh\n```\n\n## Goose and PostgreSQL DB Info\n\nTo connect to the DataBase, use the following command (replace ${MICROSERVICE} by the affected microservice):\n```bash\ndocker-compose run postgres_${MICROSERVICE} psql --host=postgres_${MICROSERVICE} --username=${POSTGRES_USERNAME} --dbname=${POSTGRES_DB_NAME}\n```\n\nTo create a new DB migration use the following command:\n```bash\ndocker-compose run ${MICROSERVICE} sh bin/goose_new_migration.sh ${MIGRATION_NAME}\n```\n\nTo apply the db_migrations use the following command:\n```bash\ndocker-compose run ${MICROSERVICE} sh bin/goose_apply_migrations.sh ${POSTGRES_CONTAINER} ${POSTGRES_USERNAME} ${POSTGRES_PASSWORD} ${POSTGRES_DB_NAME}\n```\n\nTo unapply the db_migrations use the following command:\n```bash\ndocker-compose run ${MICROSERVICE} sh bin/goose_downgrade_migration.sh ${POSTGRES_CONTAINER} ${POSTGRES_USERNAME} ${POSTGRES_PASSWORD} ${POSTGRES_DB_NAME}\n```\n\n## Adding or updating Go dependencies\n\nTo add new go dependencies we just have to use the following commands inside the `app` directory. This can be done through your local environment as long as you have go installed.\n```bash\ngo get ${DEPENDENCY}@${VERSION}\ngo mod tidy\n```\n\nIf you are adding an executable go dependency, add it to the `tools.go` file and follow the instructions there (basically the same instructions above).\n\n## Adding or updating Python dependencies\n\nSo far I've been adding these manually to the `test/requirements.txt` file. After that, we need to re-build the python container.\n\n## Updating Protos\n\nUpdate the `app/bin/generate_protos.sh` and `test/bin/generate_protos.sh` and then execute the following commands:\n```bash\ndocker-compose run go_builder sh bin/generate_protos.sh\ndocker-compose build python_tests\ndocker-compose run python_tests sh bin/generate_protos.sh\n```\n\n## Updating Webserver endpoints\n\nIn order to modify the webserver endpoints, we have to follow some guidelines related to the go-swagger spec generation:\n* To generate the go swagger files:\n```bash\ndocker-compose run go_builder swagger generate spec -o ./swagger/swagger.yaml\ndocker-compose run go_builder swagger generate spec -o ./swagger/swagger.json\n```\n\n## Check the Swagger docs (HTML)\n\nGoing to the `localhost/swagger` URL in a browser (after running the project) should be enough!\n\n## Call gRPC endpoints manually\n\nExecute the following command:\n```bash\ndocker-compose run go_builder grpcurl -plaintext -d '${REQUEST_BODY}' ${MICROSERVICE}:8080 go_webserver.${MICROSERVICE}.${SERVICE}/${RPC}\n```\n\n## Call Webserver endpoints manually\n\nWill refine this section soon but the webserver endpoints should be accessible via postman, curl or any other http client by calling the `localhost/api` URL.\n\n## Changes and Pull Requests\n\nEvery change has to be made via a Pull Request, and CircleCI checks are needed.\nEven for the repo administrators.\n\n## Github Releases\n\nTo understand how Github releases work for this repository, this documentation should be useful: https://github.com/go-modules-by-example/index/blob/master/009_submodules/README.md.\nThis section will probably change once a Vue js UI is added.\n\n## Dependabot\n\nThis repo uses Dependabot to keep its Go dependencies up to date.\nThe config was created following this blog article: https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/\nAnd the github docs: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafaguilarr%2Fgo-example-webserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafaguilarr%2Fgo-example-webserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafaguilarr%2Fgo-example-webserver/lists"}