restify-swagger-jsdoc
Create Swagger documentation page based on jsdoc
Installation
npm install restify-swagger-jsdoc --production
Initialization
To initialize the swagger JSDoc page, simply add this lines to the file that loads your restify server :
var restifySwaggerJsdoc = require('restify-swagger-jsdoc');
restifySwaggerJsdoc.createSwaggerPage({
title: 'API documentation',
version: '1.0.0',
server: server,
path: '/docs/swagger',
apis: [ `${__dirname}/controllers/*.js` ],
definitions: {myObject: require('api/myObject.json')},
routePrefix: 'prefix',
forceSecure: false
});
With these settings, assuming that your server listens on port 80, the Swagger documentation page will be available at http://localhost/docs/swagger.
The swagger.json file is available at http://localhost/docs/swagger/swagger.json.
How to document the API
This module is based on swagger-jsdoc, so you can refer to this module's documentation to document your API.