{"id":19357877,"url":"https://github.com/swiftsoftwaregroup/swift-api-rest-go","last_synced_at":"2026-03-15T09:50:59.106Z","repository":{"id":250368727,"uuid":"834170052","full_name":"swiftsoftwaregroup/swift-api-rest-go","owner":"swiftsoftwaregroup","description":"REST Web API using Go and Gin","archived":false,"fork":false,"pushed_at":"2024-07-30T18:19:33.000Z","size":353,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T00:43:41.546Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swiftsoftwaregroup.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-26T15:12:43.000Z","updated_at":"2024-07-30T18:19:37.000Z","dependencies_parsed_at":"2025-01-20T00:39:40.562Z","dependency_job_id":"e830cf8e-0dd1-4fe8-8bd2-4545bfbf791c","html_url":"https://github.com/swiftsoftwaregroup/swift-api-rest-go","commit_stats":null,"previous_names":["swiftsoftwaregroup/swift-api-rest-go"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftsoftwaregroup%2Fswift-api-rest-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftsoftwaregroup%2Fswift-api-rest-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftsoftwaregroup%2Fswift-api-rest-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftsoftwaregroup%2Fswift-api-rest-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swiftsoftwaregroup","download_url":"https://codeload.github.com/swiftsoftwaregroup/swift-api-rest-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243358212,"owners_count":20277991,"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","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":[],"created_at":"2024-11-10T07:09:31.084Z","updated_at":"2025-12-26T09:28:45.960Z","avatar_url":"https://github.com/swiftsoftwaregroup.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swift-api-rest-go\n\nThis project implements a simple API just to illustrate how one would go about implementing a REST API using [Gin](https://gin-gonic.com) and [Go](https://go.dev). \n\n## Setup\n\n* [Setup for macOS](./docs/setup-macos.md)\n\n## Run\n\n```bash\nsource configure.sh\n\n# debug\ngo run main.go\n\n# release\nexport GIN_MODE=release\ngo run main.go\n\n# use database file instead of in-memory databse\nexport DATABASE_URL=\"books.db\" \ngo run main.go\n```\n\nBrowse the docs and test the API via the Swagger UI:\n\n```bash\nopen http://localhost:8001/docs\n```\n\n![swagger-ui](./docs/swagger-ui.png)\n\nBrowse the docs using Redoc. This is an alternative to the Swagger UI:\n\n```bash\nopen http://localhost:8001/redoc\n```\n\n![redoc-ui](./docs/redoc-ui.png)\n\n## Updating the code\n\n```bash\nsource configure.sh\n```\n\nOpen the project directory in Visual Studio Code:\n\n```bash\ncode .\n```\n\nIf you update the API metadata, make sure you run `./swag-init.sh`  to update the `swag` module:\n\n```bash\n# runs `swag init --output ./swag` \n./swag-init.sh\n```\n\n## Development\n\nRun the tests (from the command line):\n\n```sh\n./test.sh\n\n# or\nGIN_MODE=release go test\n```\n\nGenerate test coverage report:\n\n```bash\n./coverage.sh\n\n# or\nGIN_MODE=release go test -coverprofile=coverage.out\ngo tool cover -func=coverage.out\ngo tool cover -html=coverage.out -o coverage.html\n\n# to see the HTML report\nopen coverage.html\n```\n\n## Run in Podman / Docker \n\n\u003e In order to do this you will need Podman. See [Setup Podman on macOS](./docs/setup-podman-macos.md) for details.\n\nRebuild container image and start container:\n\n```bash\n./scripts/podman.sh\n```\n\nDelete container and image:\n\n```bash\n./scripts/podman-delete.sh\n```\n\n## How to create a new project\n\n```bash\n# create module\ngo mod init swift-api-rest-go\n\n# add packages\ngo get -u github.com/gin-gonic/gin\ngo get -u gorm.io/gorm\ngo get -u gorm.io/driver/sqlite\n\n# Swagger and Redoc UI \ngo get -u github.com/go-openapi/runtime/middleware\n\n# testing / asserts / mocking\ngo get github.com/stretchr/testify\n\n# tools\ngo install -a golang.org/x/tools/cmd/godoc@latest \ngo install -a github.com/swaggo/swag/cmd/swag@latest \ngo install -a github.com/mitranim/gow@latest \n\n# generate swagger docs\nswag init --output ./swag\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftsoftwaregroup%2Fswift-api-rest-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswiftsoftwaregroup%2Fswift-api-rest-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftsoftwaregroup%2Fswift-api-rest-go/lists"}