Gathering detailed insights and metrics for swagger-ui-express-oauth2
Gathering detailed insights and metrics for swagger-ui-express-oauth2
Gathering detailed insights and metrics for swagger-ui-express-oauth2
Gathering detailed insights and metrics for swagger-ui-express-oauth2
npm install swagger-ui-express-oauth2
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1 Commits
1 Forks
2 Watching
1 Branches
1 Contributors
Updated on 17 Jan 2018
HTML (74.98%)
JavaScript (25.02%)
Cumulative downloads
Total Downloads
Last day
0%
16
Compared to previous day
Last week
135%
47
Compared to previous week
Last month
64.3%
92
Compared to previous month
Last year
-16.7%
418
Compared to previous year
Adds middleware to your express app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
In app's package.json
"swagger-ui-express": "latest" // or desired version
Express setup app.js
1const express = require('express'); 2const app = express(); 3const swaggerUi = require('swagger-ui-express'); 4const swaggerDocument = require('./swagger.json'); 5 6app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
Open http://<app_host>
:<app_port>
/api-docs in your browser to view the documentation.
If you want to set up routing based on the swagger document checkout swagger-express-router
If you are using swagger-jsdoc simply pass the swaggerSpec into the setup function:
1// Initialize swagger-jsdoc -> returns validated swagger spec in json format 2const swaggerSpec = swaggerJSDoc(options); 3 4app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
By default the Swagger Explorer bar is hidden, to display it pass true as the second parameter to the setup function:
1const express = require('express'); 2const app = express(); 3const swaggerUi = require('swagger-ui-express'); 4const swaggerDocument = require('./swagger.json'); 5 6var showExplorer = true; 7 8app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument, showExplorer));
To pass custom options e.g. validatorUrl, to the SwaggerUi client pass an object as the third parameter:
1const express = require('express'); 2const app = express(); 3const swaggerUi = require('swagger-ui-express'); 4const swaggerDocument = require('./swagger.json'); 5 6var showExplorer = true; 7var options = { 8 validatorUrl : null 9}; 10 11app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument, showExplorer, options));
To customize the style of the swagger page, you can pass custom CSS as the fourth parameter.
E.g. to hide the swagger header:
1const express = require('express'); 2const app = express(); 3const swaggerUi = require('swagger-ui-express'); 4const swaggerDocument = require('./swagger.json'); 5 6var showExplorer = false; 7var options = {}; 8var customCss = '#header { display: none }'; 9 10app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument, showExplorer, options, customCss));
Install phantom npm install npm test
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/1 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-25
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