How to use the swagger-stats.getMiddleware function in swagger-stats

To help you get started, we’ve selected a few swagger-stats examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BlueSCar / cfb-api / config / express.js View on Github external
secret: process.env.SESSION_SECRET,
        maxAge: 7 * 24 * 60 * 60 * 1000,
        secureProxy: true
    }));
    app.use(cookieParser());
    app.use(bodyParser.json());
    app.use(bodyParser.urlencoded({
        extended: true
    }));

    const dbInfo = require('./database')();

    require('./swagger')(app, cors);
    app.use('/api/docs', cors(), express.static('./node_modules/swagger-ui-dist'));

    app.use(swStats.getMiddleware({
        swaggerSpec: require('../swagger'),
        apdexThreshold: 250,
        authentication: true,
        onAuthenticate: (req, username, password) => {
            return username.toLowerCase() == process.env.USERNAME.toLowerCase() && password == process.env.PASSWORD
        }
    }));

    app.use(postgraphile(dbInfo.connectionString, 'public', {
        disableDefaultMutations: true,
        graphiql: true
    }));

    let corsConfig = cors(corsOptions);
    require('../app/coach/coach.route')(app, dbInfo.db, corsConfig);
    require('../app/game/game.route')(app, dbInfo.db, corsConfig, speedLimiter);
github dofapi / dofapi / index.js View on Github external
beforeNext: async server => {
    const app = new serverApp.DofapiApplication();
    await app.boot();
    server.use(swStats.getMiddleware({ swaggerSpec: apiSpec }));
    server.use('/', app.requestHandler);
  },
});
github metrue / fx / bundler / node / assets / app.js View on Github external
const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
const cors = require('@koa/cors');
const swStats = require('swagger-stats');
const e2k = require('express-to-koa');
const fx = require('./fx');

const app = new Koa();

app.use(e2k(swStats.getMiddleware({})));
app.use(cors({
  origin: '*',
}));
app.use(bodyParser());
app.use(fx);

app.listen(3000);

swagger-stats

API Telemetry and APM. Trace API calls and Monitor API performance, health and usage statistics in Node.js Microservices, based on express routes and Swagger (Open API) specification

MIT
Latest version published 10 months ago

Package Health Score

69 / 100
Full package analysis

Popular swagger-stats functions