{"id":33726772,"url":"https://github.com/issue9/web","last_synced_at":"2026-04-08T17:31:34.928Z","repository":{"id":34298337,"uuid":"38201634","full_name":"issue9/web","owner":"issue9","description":"通用的 web 框架","archived":false,"fork":false,"pushed_at":"2026-03-30T04:24:09.000Z","size":4594,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-03-30T06:46:15.481Z","etag":null,"topics":["api","api-framework","api-server","framework","framework-go","go","golang","server","web","web-framework"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/issue9/web","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/issue9.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-06-28T14:25:28.000Z","updated_at":"2026-03-30T04:08:41.000Z","dependencies_parsed_at":"2024-04-17T05:40:23.378Z","dependency_job_id":"36eb7155-f9f1-4b15-a3b1-252c61887340","html_url":"https://github.com/issue9/web","commit_stats":{"total_commits":2055,"total_committers":1,"mean_commits":2055.0,"dds":0.0,"last_synced_commit":"46fa15411396093c9ae5a1989a15db982bf173a5"},"previous_names":[],"tags_count":205,"template":false,"template_full_name":null,"purl":"pkg:github/issue9/web","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/issue9%2Fweb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/issue9%2Fweb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/issue9%2Fweb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/issue9%2Fweb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/issue9","download_url":"https://codeload.github.com/issue9/web/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/issue9%2Fweb/sbom","scorecard":{"id":496245,"data":{"date":"2025-08-11","repo":{"name":"github.com/issue9/web","commit":"5cc2c0e3e320eac0bba55225ae55a47ed0cc4588"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/cmd.yml:1","Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/test.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":"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":"SAST","score":10,"reason":"SAST tool detected: CodeQL","details":["Info: SAST configuration detected: CodeQL","Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cmd.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/issue9/web/cmd.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cmd.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/issue9/web/cmd.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/issue9/web/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/issue9/web/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/issue9/web/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/issue9/web/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/issue9/web/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/issue9/web/release.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/issue9/web/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/issue9/web/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/issue9/web/test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/issue9/web/test.yml/master?enable=pin","Info:   0 out of  10 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction 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":"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: MIT License: 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":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.104.1 not signed: https://api.github.com/repos/issue9/web/releases/216944722","Warn: release artifact v0.104.0 not signed: https://api.github.com/repos/issue9/web/releases/214304804","Warn: release artifact v0.103.3 not signed: https://api.github.com/repos/issue9/web/releases/212966953","Warn: release artifact v0.103.2 not signed: https://api.github.com/repos/issue9/web/releases/211463374","Warn: release artifact v0.103.1 not signed: https://api.github.com/repos/issue9/web/releases/211188132","Warn: release artifact v0.104.1 does not have provenance: https://api.github.com/repos/issue9/web/releases/216944722","Warn: release artifact v0.104.0 does not have provenance: https://api.github.com/repos/issue9/web/releases/214304804","Warn: release artifact v0.103.3 does not have provenance: https://api.github.com/repos/issue9/web/releases/212966953","Warn: release artifact v0.103.2 does not have provenance: https://api.github.com/repos/issue9/web/releases/211463374","Warn: release artifact v0.103.1 does not have provenance: https://api.github.com/repos/issue9/web/releases/211188132"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/release.yml:10"],"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":"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"}}]},"last_synced_at":"2025-08-19T20:28:56.085Z","repository_id":34298337,"created_at":"2025-08-19T20:28:56.085Z","updated_at":"2025-08-19T20:28:56.085Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31566738,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["api","api-framework","api-server","framework","framework-go","go","golang","server","web","web-framework"],"created_at":"2025-12-04T12:01:55.869Z","updated_at":"2026-04-08T17:31:34.899Z","avatar_url":"https://github.com/issue9.png","language":"Go","readme":"# web\n\n[![Test](https://github.com/issue9/web/actions/workflows/test.yml/badge.svg)](https://github.com/issue9/web/actions/workflows/test.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/issue9/web)](https://goreportcard.com/report/github.com/issue9/web)\n[![codecov](https://codecov.io/gh/issue9/web/graph/badge.svg?token=D5y3FOJk8A)](https://codecov.io/gh/issue9/web)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/issue9/web)](https://pkg.go.dev/github.com/issue9/web)\n![Go version](https://img.shields.io/github/go-mod/go-version/issue9/web)\n![License](https://img.shields.io/github/license/issue9/web)\n\nweb 是一个比较完整的 API 开发框架，相对于简单的路由，提供了更多的便利功能。\n如果你只是需要一个简单的路由工具，那么你可以移步到 [mux](https://github.com/issue9/mux)。\n\n```go\npackage main\n\nimport \"github.com/issue9/web\"\nimport \"github.com/issue9/web/server\"\n\n// main.go\nfunc main() {\n    srv, err := server.New(\"web\", \"1.0.0\", \u0026server.Options{})\n    router := srv.Routers().New()\n    router.Get(\"/admins\", getAdmins).\n        Get(\"/groups\", getGroups)\n\n    srv.Serve()\n}\n\nfunc getAdmins(ctx* web.Context) web.Responser {\n    return ctx.NotImplemented()\n}\n\nfunc getGroups(ctx* web.Context) web.Responser {\n    return ctx.NotImplemented()\n}\n```\n\n## 字符集和文档类型\n\n\u003chttps://www.iana.org/assignments/character-sets/character-sets.xhtml\u003e 中列出的字符集都能自动转换。\n文档类型由 `Server.Mimetypes` 指定。\n\n```go\npackage main\n\nimport (\n\t\"github.com/issue9/web\"\n\t\"github.com/issue9/web/server\"\n\t\"github.com/issue9/web/mimetype/json\"\n\t\"github.com/issue9/web/mimetype/xml\"\n)\n\nsrv := server.New(\"app\", \"1.0.0\", \u0026server.Options{\n\tCodec: web.NewCodec().\n\t\tAddMimetype(xml.Mimetype, json.Marshal, json.Unmarshal, xml.ProblemMimetype, true, true).\n\t\tAddMimetype(xml.Mimetype, xml.Marshal, xml.Unmarshal, xml.ProblemMimetype, true, true)\n\t}\n})\n\nsrv.Serve()\n```\n\n客户端只要在请求时设置 Accept 报头就可返回相应类型的数据，而 Accept-Charset 报头可设置接收的字符集。\nContent-Type 则可以有向服务器指定提交内容的文档类型和字符集。\n\n## 错误处理\n\n框架根据 [RFC7807](https://datatracker.ietf.org/doc/html/rfc7807) 提供了一种输出错误信息内容的机制。\n\n在处理出错时，调用 Context.Problem 即可：\n\n```go\nfunc getAdmins(ctx* web.Context) web.Responser {\n\treturn ctx.Problem(web.ProblemBadRequest).WithParam(\"param\", \"invalid format\")\n}\n```\n\n## openapi\n\n可直接在添加 API 的中间件上指定文档内容：\n\n```go\nsrv := server.New(\"app\", \"1.0.0\", ...)\nrouter := s.Routers().New(...)\ndoc := openapi.New(srv, web.Phrase(\"title\")) // 声明文档对象\n\nrouter.Get(\"/users\", doc.API(func(o* openapi.Operation){\n\to.Desc(web.Phrase(\"desc of api\")). // 接口的描述\n\t\tBody(). // 请求内容\n\t\tResponse() // 指定返回内容\n}))\n\nrouter.Get(\"/openapi\", doc.Handler()) // 将文档以接口的形式输出\n```\n\n## 插件\n\n- \u003chttps://github.com/issue9/webuse\u003e 提供了中间件、插件、过滤器等常用的功能。\n\n## 工具\n\n\u003chttps://github.com/issue9/web/releases\u003e 提供了一个简易的辅助工具。可以帮助用户完成以下工作：\n\n- 提取和更新本地化信息；\n- 热编译项目；\n- 为枚举类型生成常用接口；\n- 根据对象的注释生成 markdown 文档；\n- 根据模板生成项目；\n\nmacOS 和 linux 用户可以直接使用 brew 进行安装：\n\n```shell\nbrew tap caixw/brew\nbrew install caixw/brew/web\n```\n\n## 版权\n\n本项目采用 [MIT](https://opensource.org/licenses/MIT) 开源授权许可证，完整的授权说明可在 [LICENSE](LICENSE) 文件中找到。\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fissue9%2Fweb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fissue9%2Fweb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fissue9%2Fweb/lists"}