{"id":13487495,"url":"https://github.com/eggjs/egg-router-plus","last_synced_at":"2026-01-23T18:16:19.030Z","repository":{"id":48793266,"uuid":"113594324","full_name":"eggjs/egg-router-plus","owner":"eggjs","description":"The missing router feature for eggjs","archived":false,"fork":false,"pushed_at":"2021-07-12T03:22:09.000Z","size":31,"stargazers_count":140,"open_issues_count":1,"forks_count":9,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-10-08T00:33:02.444Z","etag":null,"topics":["egg","egg-plugin","egg-router","eggjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"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/eggjs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","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":"2017-12-08T16:24:56.000Z","updated_at":"2025-07-25T09:16:52.000Z","dependencies_parsed_at":"2022-09-18T16:10:19.594Z","dependency_job_id":null,"html_url":"https://github.com/eggjs/egg-router-plus","commit_stats":null,"previous_names":["atian25/egg-router-plus"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/eggjs/egg-router-plus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-router-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-router-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-router-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-router-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/egg-router-plus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-router-plus/sbom","scorecard":{"id":368767,"data":{"date":"2025-08-11","repo":{"name":"github.com/eggjs/egg-router-plus","commit":"cdfec8012f8e051a6b55d848cd4112191e566085"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.4,"checks":[{"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":"Code-Review","score":4,"reason":"Found 10/22 approved changesets -- score normalized to 4","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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nodejs.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":"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":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-router-plus/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-router-plus/nodejs.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-router-plus/nodejs.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:35","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   1 out of   2 npmCommand 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":"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":"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":"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":"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":"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":-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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 13 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-18T12:29:43.191Z","repository_id":48793266,"created_at":"2025-08-18T12:29:43.191Z","updated_at":"2025-08-18T12:29:43.191Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28697428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: 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":["egg","egg-plugin","egg-router","eggjs"],"created_at":"2024-07-31T18:01:00.010Z","updated_at":"2026-01-23T18:16:18.999Z","avatar_url":"https://github.com/eggjs.png","language":"JavaScript","readme":"# egg-router-plus\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-router-plus.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-router-plus\n[travis-image]: https://img.shields.io/travis/eggjs/egg-router-plus.svg?style=flat-square\n[travis-url]: https://travis-ci.org/eggjs/egg-router-plus\n[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-router-plus.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/eggjs/egg-router-plus?branch=master\n[david-image]: https://img.shields.io/david/eggjs/egg-router-plus.svg?style=flat-square\n[david-url]: https://david-dm.org/eggjs/egg-router-plus\n[snyk-image]: https://snyk.io/test/npm/egg-router-plus/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-router-plus\n[download-image]: https://img.shields.io/npm/dm/egg-router-plus.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-router-plus\n\nThe missing router features for [eggjs](https://eggjs.org)\n\n## Install\n\n```bash\n$ npm i egg-router-plus --save\n```\n\nThen mount plugin:\n\n```js\n// {app_root}/config/plugin.js\nexports.routerPlus = {\n  enable: true,\n  package: 'egg-router-plus',\n};\n```\n\n## Features\n\n### load `app/router/**/*.js`\n\nthis plugin will auto load router define at `app/router/**/*.js`.\n\n**Notice: all sub routers will be loaded before `app/router.js`, please ensure all the sub router definitions are not conflict(better to use `app.router.namespace` to create different namespaces for each sub router file).**\n\n### app.router.namespace\n\n```js\napp.router.namespace(prefix, ...middlewares);\n```\n\n- `prefix` - {String}, the prefix string of sub router\n- `middlewares` - {...Function}, optional group middlewares\n\nSupport same as Router:\n\n- `router.verb('path-match', app.controller.action);`\n- `router.verb('path-match', middleware1, ..., middlewareN, app.controller.action);`\n- `router.verb('router-name', 'path-match', app.controller.action);`\n- `router.verb('router-name', 'path-match', middleware1, ..., middlewareN, app.controller.action);`\n\n`prefix` and `path` are not allow to be `regex`, and `prefix` can't be '/'.\n\n```js\n// {app_root}/app/router.js\nmodule.exports = app =\u003e {\n  const subRouter = app.router.namespace('/sub');\n  // curl localhost:7001/sub/test\n  subRouter.get('/test', app.controller.sub.test);\n  subRouter.get('sub_upload', '/upload', app.controller.sub.upload);\n\n  // const subRouter = app.router.namespace('/sub/:id');\n  // const subRouter = app.router.namespace('/sub', app.middleware.jsonp());\n\n  // output: /sub/upload\n  console.log(app.url('sub_upload'));\n};\n```\n\n Every different prefix will bind to different router instance, and all the namespaces will sort by trie tree to ensure best match.\n\n ```js\n module.exports = app =\u003e {\n  const apiRouter = app.router.namespace('/api');\n  const apiWebRouter = app.router.namespace('/api/web');\n  const apiWebAdminRouter = app.router.namespace('/api/web/admin');\n  apiRouter.get('/:a/:b/:c', controller.api.one);\n  apiWebRouter.get('/:a/:b', controller.api.two);\n  apiWebAdminRouter.get('/:a', controller.api.three);\n  // /api/web/admin/hello =\u003e controller.api.three\n  // /api/web/foo/hello =\u003e controller.api.two\n  // /api/foo/bar/hello =\u003e controller.api.one\n};\n ```\n\n## Known issues\n\n- sub `redirect` is not support, use `app.router.redirect()` or redirect to a named router.\n\n```js\nconst subRouter = app.router.namespace('/sub');\n\n// will redirect `/sub/go` to `/anyway`, not `/sub/anyway`\nsubRouter.redirect('/go', '/anyway');\n\n// just use router\nrouter.redirect('/sub/go', '/sub/anyway');\n\n// or redirect to a named router\nsubRouter.get('name_router', '/anyway', app.controller.sub.anyway);\n// will redirect `/sub/go_name` to `/sub/anyway` which is named `name_router`\nsubRouter.redirect('/sub/go_name', 'name_router');\n```\n\n## Questions \u0026 Suggestions\n\nPlease open an issue [here](https://github.com/eggjs/egg/issues).\n\n## License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":["Plugins","仓库"],"sub_categories":["插件"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-router-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fegg-router-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-router-plus/lists"}