{"id":13799436,"url":"https://github.com/menems/koa-66","last_synced_at":"2025-09-07T01:30:34.222Z","repository":{"id":135947671,"uuid":"44768854","full_name":"menems/koa-66","owner":"menems","description":"Router middleware for koa 2","archived":false,"fork":false,"pushed_at":"2017-02-25T10:04:09.000Z","size":86,"stargazers_count":51,"open_issues_count":2,"forks_count":9,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T00:26:46.156Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/menems.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2015-10-22T19:38:18.000Z","updated_at":"2023-10-09T14:32:55.000Z","dependencies_parsed_at":"2023-05-15T21:45:15.609Z","dependency_job_id":null,"html_url":"https://github.com/menems/koa-66","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/menems/koa-66","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/menems%2Fkoa-66","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/menems%2Fkoa-66/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/menems%2Fkoa-66/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/menems%2Fkoa-66/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/menems","download_url":"https://codeload.github.com/menems/koa-66/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/menems%2Fkoa-66/sbom","scorecard":{"id":636397,"data":{"date":"2025-08-11","repo":{"name":"github.com/menems/koa-66","commit":"9d847efea7b612e114e37f082244263cf2cad12d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.1,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/30 approved changesets -- score normalized to 1","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":-1,"reason":"No tokens found","details":null,"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"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":"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 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"}},{"name":"Vulnerabilities","score":0,"reason":"35 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-832h-xg76-4gv6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-h452-7996-h45h","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9qj9-36jm-prpv","Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-593f-38f6-jp5m","Warn: Project is vulnerable to: GHSA-x2rg-q646-7m2v","Warn: Project is vulnerable to: GHSA-jgmv-j7ww-jx2x","Warn: Project is vulnerable to: GHSA-wrvr-8mpx-r7pp","Warn: Project is vulnerable to: GHSA-hxm2-r34f-qmc5","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-gqgv-6jq5-jjj9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-8225-6cvr-8pqp"],"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-21T09:17:22.929Z","repository_id":135947671,"created_at":"2025-08-21T09:17:22.929Z","updated_at":"2025-08-21T09:17:22.929Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273986610,"owners_count":25202704,"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-09-06T02:00:13.247Z","response_time":2576,"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-08-04T00:01:02.698Z","updated_at":"2025-09-07T01:30:34.003Z","avatar_url":"https://github.com/menems.png","language":"JavaScript","readme":"# koa-66\n\n[![Node.js Version][node-image]][node-url]\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Dependency Status][dep-image]][dep-url]\n[![Coverage Status][cov-img]][cov-url]\n\nRouter middleware for [koa](https://github.com/koajs/koa/) v2.\n\n\u003e feedbacks are welcome\n\n## Features\n\n- [Plugin middleware support](https://github.com/menems/koa-66#plugin-support)\n- Express like http verbs methods (including `all`)\n- Express like use function\n- Express like param function\n- Automatic OPTIONS response\n- Automatic HEAD when GET is present\n- 501 and 405 status (throw capability with headers)\n- Mount instance on specific path\n- Multiple middleware as arguments\n- Multiple middleware as array\n\n## Installation\n\n```bash\n# with npm\n$ npm install koa-66\n\n$ with yarn\n$ yarn add koa-66\n```\n\n## Example\n\n```javascript\nconst Koa = require('koa');\nconst Router = require('koa-66');\nconst app = new Koa();\n\nconst router = new Router();\nconst mainRouter  = new Router();\n\nrouter.param('id', (ctx, next, id) =\u003e {\n        ctx.yolo = id;\n        return next();\n});\n\nrouter.use(async function(ctx, next) {\n    ctx.a = \" \";\n    await next();\n});\n\nrouter.get('/:id', (ctx, next) =\u003e {\n    return next().then(() =\u003e {\n        ctx.body += ctx.a + ctx.yolo;\n   })\n});\n\nrouter.get('/:id', async function(ctx) {\n    ctx.body = await Promise.resolve('hello');\n});\n\nmainRouter.mount('/pouet', router);\n\napp.use(mainRouter.routes());\n\napp.listen(1664);\n// GET http://localhost:1664/pouet/world\n// =\u003e hello world\n```\n\n## Example with __throw__ option\n\n```javascript\nconst Koa = require('koa');\nconst Router = require('koa-66');\nconst app = new Koa();\n\nconst router = new Router();\n\napp.use(async function(ctx, next) {\n\ttry {\n\t\tawait next();\n\t}catch(e){\n\t\tif (e.status === 405) {\n\t\t\tctx.status = 405;\n\t\t\tctx.set(e.headers);\n\t\t}\n\t}\n})\n\nrouter.get('/', (ctx) =\u003e ctx.body = 'hello');\n\napp.use(router.routes({throw: true}));\n\napp.listen(1664);\n\n// \u003e curl http://localhost:1664/ -I -X POST\n//\n// HTTP/1.1 405 Method Not Allowed\n// allow: HEAD, GET\n// Content-Type: text/plain; charset=utf-8\n// Content-Length: 18\n// Date: Wed, 04 Nov 2015 10:29:06 GMT\n// Connection: keep-alive\n\n```\n\n## Plugin support\n\nI don't know if Plugin is a good term for this feature.\nThe goal was to add cappability to register some middleware on a main Router that will be inject via config object on different route.\n(ex: authentication  or acl behaviour).\nWhy? Because I am lazy to require some middleware in all my router script with generaly relatif path...\n\nSo I decided to add the possibility to inject an object at first parameter (that will be a config object) and adding an extra middleware that will be inject in middleware stack. To register this plugin just use a `plugin()`method.\n\n```javascript\nconst Router = require('koa-66');\nconst main = new Router();\n\n// you can use multiple middleware as arguments or array\nmain.plugin('authent', (ctx, next) =\u003e {\n    // pick plugin config object on ctx.state.plugins.\n    // here ctx.state.plugins.authent === true;\n\t// do stuff inject user on context for example\n\treturn next();\n\t//or throw or do nothing that will stop execution of router stack\n})\n\nmain.plugin('acl', (ctx, next) =\u003e {\n    // here ctx.state.plugins.acl === ['admin'];\n\t// do stuff check role via ctx.state.plugins.acl for example\n\treturn next();\n\t//or throw or do nothing that will stop execution of router stack\n})\n\nconst router = new Router();\n\nrouter.use({authent: true});\n//options here is a boolean,\n//but you can pass everything you want,\n//and it will be inject as options\n\nrouter.get('/private', {acl:['admin']}, \n\tctx =\u003e ctx.body = 'private'\n)\n\nmain.mount('/api', router);\n...\t\n// order of call /api/private\n// 1 plugin authent\n// 2 plugin acl\n// 3 real middleware \n\n``` \n\n## Test\n```bash\n# npm test\n\n```\n\n[node-image]: https://img.shields.io/node/v/koa-66.svg?style=flat-square\n[node-url]: https://nodejs.org\n[npm-image]: https://img.shields.io/npm/v/koa-66.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/koa-66\n[travis-image]: https://img.shields.io/travis/menems/koa-66/master.svg?style=flat-square\n[travis-url]: https://travis-ci.org/menems/koa-66\n[dep-image]: http://david-dm.org/menems/koa-66.svg?style=flat-square\n[dep-url]:http://david-dm.org/menems/koa-66\n[cov-img]:https://coveralls.io/repos/menems/koa-66/badge.svg?branch=master\u0026service=github\n[cov-url]:https://coveralls.io/github/menems/koa-66?branch=master\n","funding_links":[],"categories":["仓库"],"sub_categories":["中间件"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmenems%2Fkoa-66","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmenems%2Fkoa-66","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmenems%2Fkoa-66/lists"}