1.3.0 • Published 6 years ago

swagrr v1.3.0

Weekly downloads
1
License
ISC
Repository
bitbucket
Last release
6 years ago

SwagRR

This is a convenience wrapper for swagger.io, it contains "swagger-jsdoc" and "swagger-tools".

npm Version npm Downloads Known Vulnerabilities

Reference Links:

Supported Swagger Versions

  • 2.0

Install

$ npm install swagrr --save

Quick Start

const swagrr = require('swagrr');
const app = express();
const bodyParser = require('body-parser');
const http = require('http');

app.use(cookieParser());
app.use(bodyParser.json({limit: '4mb'}));
app.use(bodyParser.urlencoded({extended: true}));

// Wrap your app initialization with swagger initialization so it can record your routes
swagrr.initAppWithSwagger(app, {
    title: 'Hello World API via Swagger',
    description: 'HelloWorld (semi)auto-generated api documentation!',
    version: '0.1',
    host: 'localhost:7777',
    isUseToken: true,
    isForceForProduction: true, // Omit this or use false to skip swagger loading in production environment
    apiPaths: './routes/*.js', './app/models/*.js',
    customSwaggerUiDir: './swagger-ui-custom' // Omit to use default swagger-ui html
}, function (app) {
    // Init your routes here
    app.use(require('../routes'));

    // Start the server
    const server = http.createServer(app).listen(app.get('port'), function () {
        console.log('Listening on http://localhost:' + app.get('port'));
    });

    process.on('SIGTERM', function () {
        server.close(function () {
            process.exit(0);
        });
    });
});

Need help?

Lesh_M @ Round Robin

1.3.0

6 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago