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

Swagger UI Express

  • 1.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
700K
decreased by-56.52%
Maintainers
1
Weekly downloads
 
Created

What is swagger-ui-express?

The swagger-ui-express npm package is used to serve auto-generated swagger-ui generated API docs from express, based on a swagger.json file. The package allows you to serve the Swagger UI bound to your Swagger document. This is helpful for creating API documentation that can be read and tested interactively via a browser.

What are swagger-ui-express's main functionalities?

Serve API Documentation

This feature serves the API documentation on a specified express route. The `swagger.json` contains the API definitions.

const swaggerUi = require('swagger-ui-express');
const swaggerDocument = require('./swagger.json');

app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));

Custom CSS

This feature allows you to apply custom CSS to the Swagger UI to modify its appearance according to your preferences.

const options = {
customCss: '.swagger-ui .topbar { display: none }'
};
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument, options));

Custom Site Title

This feature allows you to set a custom title for the API documentation page.

const options = {
customSiteTitle: 'My API Docs'
};
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument, options));

Serve Swagger UI with Custom API Docs

This feature allows you to load your Swagger document from a YAML file instead of a JSON file, which some developers find more readable and easier to maintain.

const swaggerUi = require('swagger-ui-express');
const YAML = require('yamljs');
const swaggerDocument = YAML.load('./swagger.yaml');

app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));

Other packages similar to swagger-ui-express

Keywords

FAQs

Package last updated on 05 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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