swaggerize-ui

1.0.1 • Public • Published

swaggerize-ui

io.js compatibility node.js compatibility

NPM version Dependency Status Dev Dependency Status Code Climate Build Status Coverage Status

swaggerize-ui is an node express middleware to show swagger-ui for your local (or external) api.

Installation

npm install --save swaggerize-ui

Usage

'use strict';
 
var http      = require('http');
var express   = require('express');
var app       = express();
var server    = http.createServer(app);
var swaggerUi = require('swaggerize-ui');
 
app.use('/api-docs', function (req, res) {
  res.json(require('./path/to/swaggerize/docs.json'));
});
 
app.use('/docs', swaggerUi({
  docs: '/api-docs' // from the express route above.
}));
 
server.listen(8000)
  .on('listening', function () {
 
  })
  .on('error', function (err) {
 
  });
 

Options

  • docs - This is the path that gets put into to swagger-ui by default. You can do an absolute uri like above, or you can do a full url starting with http://. Default value is 'api-docs'.

  • swaggerUiPath - This is the absolute path to whatever version of swagger-ui you would like to use. This should be to the dist/ folder within that project. Default value is the path to the swagger-ui module in this module's node_modules directory.

Questions

Hopefully this is simple enough to use to help make your swaggerized apis more consumable. If you do have any questions about how to use it, feel free to open up an issue, or a pull request.

Package Sidebar

Install

npm i swaggerize-ui

Weekly Downloads

123

Version

1.0.1

License

MIT

Last publish

Collaborators

  • ksmithut