Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swagger-ui-express

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-ui-express - npm Package Compare versions

Comparing version 4.1.6 to 4.2.0

2

index.js

@@ -18,3 +18,2 @@ 'use strict'

<% favIconString %>
<% customJs %>
<style>

@@ -82,2 +81,3 @@ html

<script src="./swagger-ui-init.js"> </script>
<% customJs %>
<% customCssUrl %>

@@ -84,0 +84,0 @@ <style>

{
"name": "swagger-ui-express",
"version": "4.1.6",
"version": "4.2.0",
"description": "Swagger UI Express",

@@ -15,2 +15,4 @@ "main": "./index.js",

"test": "./node_modules/.bin/mocha test/*",
"coverage:report": "nyc ./node_modules/.bin/mocha test/* || exit 0",
"coverage:badge": "npm run coverage:report && istanbul-badges-readme --coverageDir='./coverage'",
"test-app": "node ./test/testapp/run.js "

@@ -32,4 +34,6 @@ },

"express": "4.12.2",
"istanbul-badges-readme": "^1.2.0",
"mocha": "2.2.5",
"phantom": "2.1.21"
"nyc": "^15.1.0",
"puppeteer": "5.3.1"
},

@@ -51,3 +55,3 @@ "author": {

"dependencies": {
"swagger-ui-dist": "^3.18.1"
"swagger-ui-dist": ">3.52.5"
},

@@ -54,0 +58,0 @@ "peerDependencies": {

# Swagger UI Express
| Statements | Branches | Functions | Lines |
| --------------------------- | ----------------------- | ------------------------- | -------------------- |
| ![Statements](https://img.shields.io/badge/Coverage-89.87%25-yellow.svg) | ![Branches](https://img.shields.io/badge/Coverage-78.57%25-red.svg) | ![Functions](https://img.shields.io/badge/Coverage-91.67%25-brightgreen.svg) | ![Lines](https://img.shields.io/badge/Coverage-89.74%25-yellow.svg) |
This module allows you to serve auto-generated [swagger-ui](https://swagger.io/tools/swagger-ui/) generated API docs from express, based on a `swagger.json` file. The result is living documentation for your API hosted from your API server via a route.

@@ -9,3 +13,3 @@

* [swagger-jsdoc](https://github.com/Surnet/swagger-jsdoc/blob/master/docs/GETTING-STARTED.md): Allows you to markup routes
* [swagger-jsdoc](https://github.com/Surnet/swagger-jsdoc): Allows you to markup routes
with jsdoc comments. It then produces a full swagger yml config dynamically, which you can pass to this module to produce documentation. See below under the usage section for more info.

@@ -239,3 +243,3 @@ * [swagger tools](https://github.com/swagger-api): Various tools, including swagger editor, swagger code gen etc.

const swaggerDocumentOne = require('./swagger-one.json');
const swaggerDocumentTwo = require('./swagger-one.json');
const swaggerDocumentTwo = require('./swagger-two.json');

@@ -249,3 +253,22 @@ var options = {}

### Link to Swagger document
To render a link to the swagger document for downloading within the swagger ui - then serve the swagger doc as an endpoint and use the url option to point to it:
```javascript
const express = require('express');
const app = express();
const swaggerUi = require('swagger-ui-express');
const swaggerDocument = require('./swagger.json');
var options = {
swaggerOptions: {
url: "/api-docs/swagger.json",
},
}
app.get("/api-docs/swagger.json", (req, res) => res.json(swaggerDocument));
app.use('/api-docs', swaggerUi.serveFiles(null, options), swaggerUi.setup(null, options));
```
## Requirements

@@ -252,0 +275,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc