1.0.1 • Published 7 months ago
swagger-ui-restify-loop v1.0.1
Swagger UI Restify
Adds middleware to your restify app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
Swagger version is pulled from npm module swagger-ui-dist. Please use a lock file or specify the version of swagger-ui-dist you want to ensure it is consistent across environments.
Usage
Install using npm:
$ npm install --save swagger-ui-restify-loop
Restify setup app.js
const restify = require('restify');
const app = restify.createServer();
const swaggerUi = require('swagger-ui-restify-loop');
const swaggerDocument = require('./swagger.json');
app.get(/\/api-docs\/+.*/, ...swaggerUi.serve)
app.get('/docs', swaggerUi.setup(swaggerDocument));
Open http://`<app_host>:
<app_port>`/docs in your browser to view the documentation.