Gathering detailed insights and metrics for koa2-swagger-ui
Gathering detailed insights and metrics for koa2-swagger-ui
npm install koa2-swagger-ui
Typescript
Module System
Node Version
NPM Version
TypeScript (57.07%)
Handlebars (42.93%)
Total Downloads
5,701,110
Last Day
8,364
Last Week
33,394
Last Month
150,613
Last Year
1,887,558
106 Stars
359 Commits
32 Forks
5 Watching
3 Branches
2 Contributors
Minified
Minified + Gzipped
Latest Version
5.11.0
Package Id
koa2-swagger-ui@5.11.0
Unpacked Size
20.96 kB
Size
7.79 kB
File Count
8
NPM Version
10.9.0
Node Version
22.11.0
Publised On
18 Nov 2024
Cumulative downloads
Total Downloads
Last day
10.2%
8,364
Compared to previous day
Last week
-14.7%
33,394
Compared to previous week
Last month
1%
150,613
Compared to previous month
Last year
31%
1,887,558
Compared to previous year
Host swagger ui at a given directory from your koa v2 app
Inspired by:
npm install koa2-swagger-ui --save
for more swaggerOptions see swagger-ui defaults:
1title: 'swagger', // page title 2oauthOptions: {}, // passed to initOAuth 3swaggerOptions: { // passed to SwaggerUi() 4 dom_id: 'swagger-ui-container', 5 url: 'http://petstore.swagger.io/v2/swagger.json', // link to swagger.json 6 supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'], 7 docExpansion: 'none', 8 jsonEditor: false, 9 defaultModelRendering: 'schema', 10 showRequestHeaders: false, 11 swaggerVersion: 'x.x.x' // read from package.json, 12 validatorUrl: null, // disable swagger-ui validator 13}, 14routePrefix: '/docs', // route where the view is returned 15specPrefix: '/docs/spec', // route where the spec is returned 16exposeSpec: false, // expose spec file 17hideTopbar: false, // hide swagger top bar 18favicon: '/favicon.png', // default favicon 19customCSS: `h1 { color: red }`, // Add Custom CSS on the html
1import Koa from 'koa'; 2import { koaSwagger } from 'koa2-swagger-ui'; 3 4const app = new Koa(); 5 6app.use( 7 koaSwagger({ 8 routePrefix: '/swagger', // host at /swagger instead of default /docs 9 swaggerOptions: { 10 url: 'http://petstore.swagger.io/v2/swagger.json', // example path to json 11 }, 12 }), 13); 14 15app.listen(3000);
depends on yamljs to turn your Yaml into a JS object
npm install --save yamljs
1const Koa = require('koa'); 2const Router = require('koa-router'); 3const yamljs = require('yamljs'); 4const koaSwagger = require('koa2-swagger-ui'); 5 6const router = new Router({ prefix: '/' }); 7 8const app = new Koa(); 9const router = new Router(); 10 11// .load loads file from root. 12const spec = yamljs.load('./openapi.yaml'); 13 14// example 1 using router.use() 15router.use(koaSwagger({ swaggerOptions: { spec } })); 16 17// example 2 using more explicit .get() 18router.get('/docs', koaSwagger({ routePrefix: false, swaggerOptions: { spec } })); 19 20app.use(router.routes()); 21app.listen(3000);
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
Found 8/30 approved changesets -- score normalized to 2
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-27
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