
Make sure 'explorer' option is set to 'true' in your setup options for the dropdown to be visible. To load multiple swagger documents from urls as a dropdown in the explorer bar, pass an array of object with name and url to 'urls' property to 'swaggerOptions' in the setup function. const express = require('express') Īpp.use('/api-docs', rve, tup(null, options)) To load your swagger from a url instead of injecting the document, pass null as the first parameter, and pass the relative or absolute URL as the 'url' property to 'swaggerOptions' in the setup function. Value must be the public url of the js file.
Swagger editor npm full#
If you would like to have full control over your HTML you can provide your own javascript file, value accepts absolute or relative path. You can also pass the url to a custom css file, the value must be the public url of the file and can be relative or absolute to the swagger path. to hide the swagger header: const express = require('express') ĬustomCss: '.swagger-ui. To customize the style of the swagger page, you can pass custom CSS as the 'customCss' property of the options to the setup function.Į.g. validatorUrl, to the SwaggerUi client pass an object as the 'swaggerOptions' property of the options to the setup function: const express = require('express') įor all the available options, refer to Swagger UI Configuration Custom CSS styles If you are using swagger-jsdoc simply pass the swaggerSpec into the setup function: // Initialize swagger-jsdoc -> returns validated swagger spec in json formatĬonst swaggerSpec = swaggerJSDoc(options) Īpp.use('/api-docs', rve, tup(swaggerSpec)) īy default the Swagger Explorer bar is hidden, to display it pass true as the 'explorer' property of the options to the setup function: const express = require('express') Īpp.use('/api-docs', rve, tup(swaggerDocument, options)) If you want to set up routing based on the swagger document checkout swagger-express-router swagger-jsdoc Open : /api-docs in your browser to view the documentation.

Router.get('/api-docs', tup(swaggerDocument))

Or if you are using Express router const router = require('express').Router()
Swagger editor npm install#
Install using npm: $ npm install swagger-ui-expressĮxpress setup app.js const express = require('express') Ĭonst swaggerUi = require('swagger-ui-express') Ĭonst swaggerDocument = require('./swagger.json') Īpp.use('/api-docs', rve, tup(swaggerDocument))
Swagger editor npm code#

The result is living documentation for your API hosted from your API server via a route. This module allows you to serve auto-generated swagger-ui generated API docs from express, based on a swagger.json file.
