{"id":16687671,"url":"https://github.com/pei0804/go-http-swagger","last_synced_at":"2026-04-27T09:31:02.032Z","repository":{"id":139120941,"uuid":"122824283","full_name":"pei0804/go-http-swagger","owner":"pei0804","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-25T10:52:16.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-29T04:18:28.532Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pei0804.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":"2018-02-25T10:03:19.000Z","updated_at":"2018-02-25T10:32:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"08e5ae4f-9b69-461d-8397-13edc9717944","html_url":"https://github.com/pei0804/go-http-swagger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pei0804/go-http-swagger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pei0804%2Fgo-http-swagger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pei0804%2Fgo-http-swagger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pei0804%2Fgo-http-swagger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pei0804%2Fgo-http-swagger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pei0804","download_url":"https://codeload.github.com/pei0804/go-http-swagger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pei0804%2Fgo-http-swagger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32331305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"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":[],"created_at":"2024-10-12T15:24:37.143Z","updated_at":"2026-04-27T09:31:01.995Z","avatar_url":"https://github.com/pei0804.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# http-swagger\n\n## Usage\n\n### Start using it\n1. Add comments to your API source code, [See Declarative Comments Format](https://github.com/swaggo/swag#declarative-comments-format).\n2. Download [Swag](https://github.com/swaggo/swag) for Go by using:\n\n```sh\n$ go get github.com/swaggo/swag/cmd/swag\n```\n\n3. Run the [Swag](https://github.com/swaggo/swag) in your Go project root folder which contains `main.go` file, [Swag](https://github.com/swaggo/swag) will parse comments and generate required files(`docs` folder and `docs/doc.go`).\n```sh\n$ swag init\n```\n4.Download [http-swagger](https://github.com/swaggo/http-swagger) by using:\n```sh\n$ go get -u github.com/swaggo/http-swagger\n```\nAnd import following in your code:\n\n```go\nimport \"github.com/swaggo/http-swagger\" // http-swagger middleware\n```\n\n### Canonical example:\n\n```go\npackage main\n\nimport (\n\t\"net/http\"\n\t\"github.com/go-chi/chi\"\n\t\"github.com/swaggo/http-swagger\"\n\t_ \"github.com/swaggo/http-swagger/example/docs\" // docs is generated by Swag CLI, you have to import it.\n)\n\n// @title Swagger Example API\n// @version 1.0\n// @description This is a sample server Petstore server.\n// @termsOfService http://swagger.io/terms/\n\n// @contact.name API Support\n// @contact.url http://www.swagger.io/support\n// @contact.email support@swagger.io\n\n// @license.name Apache 2.0\n// @license.url http://www.apache.org/licenses/LICENSE-2.0.html\n\n// @host petstore.swagger.io\n// @BasePath /v2\nfunc main() {\n\tr := chi.NewRouter()\n\n\tr.Get(\"/swagger/*\", gohttpSwagger.WrapHandler)\n\n\thttp.ListenAndServe(\":1323\", r)\n}\n\n```\n\n5. Run it, and browser to http://localhost:1323/swagger/index.html, you can see Swagger 2.0 Api documents.\n\n![swagger_index.html](https://user-images.githubusercontent.com/8943871/36250587-40834072-1279-11e8-8bb7-02a2e2fdd7a7.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpei0804%2Fgo-http-swagger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpei0804%2Fgo-http-swagger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpei0804%2Fgo-http-swagger/lists"}