Gathering detailed insights and metrics for koa-route
Gathering detailed insights and metrics for koa-route
Gathering detailed insights and metrics for koa-route
Gathering detailed insights and metrics for koa-route
npm install koa-route
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
446 Stars
89 Commits
46 Forks
11 Watching
9 Branches
28 Contributors
Updated on 14 Aug 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-38.4%
16,680
Compared to previous day
Last week
-20.3%
106,580
Compared to previous week
Last month
7.6%
540,502
Compared to previous month
Last year
-27.4%
4,982,220
Compared to previous year
Uber simple route middleware for koa.
1const _ = require('koa-route'); 2app.use(_.get('/pets', pets.list)); 3app.use(_.get('/pets/:name', pets.show));
If you need a full-featured solution check out koa-router, a Koa clone of express-resource.
1$ npm install koa-route
Contrived resource-oriented example:
1const _ = require('koa-route'); 2const Koa = require('koa'); 3const app = new Koa(); 4 5const db = { 6 tobi: { name: 'tobi', species: 'ferret' }, 7 loki: { name: 'loki', species: 'ferret' }, 8 jane: { name: 'jane', species: 'ferret' } 9}; 10 11const pets = { 12 list: (ctx) => { 13 const names = Object.keys(db); 14 ctx.body = 'pets: ' + names.join(', '); 15 }, 16 17 show: (ctx, name) => { 18 const pet = db[name]; 19 if (!pet) return ctx.throw('cannot find that pet', 404); 20 ctx.body = pet.name + ' is a ' + pet.species; 21 } 22}; 23 24app.use(_.get('/pets', pets.list)); 25app.use(_.get('/pets/:name', pets.show)); 26 27app.listen(3000, (err) => { 28 if (err) console.error(err.stack); 29 else console.log('listening on port 3000'); 30});
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 5/27 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More