How to use swagger2 - 1 common examples

To help you get started, we’ve selected a few swagger2 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 qlik-oss / mira / src / index.js View on Github external
const c2k = require('koa-connect');
const logger = require('./logger/Logger').get();
const version = require('../version');
const Config = require('./Config');

Config.init();

const metrics = new MetricsMiddleware({ timeBuckets: [0.01, 0.05, 0.1, 0.5, 1, 5] });
const router = require('./Routes');

metrics.initBuildInfo(version.name, version.version, version.revision, version.buildTime);
logger.info(`Mira build info: ${JSON.stringify(version)}`);
logger.info(`Mira configuration: ${JSON.stringify(Config.getConfiguration())}`);

const app = new Koa();
const document = swagger.loadDocumentSync(path.join(__dirname, './../doc/api-doc.yml'));

let killOnNextLog = false;

if (Config.rollbarToken) {
  const rollbar = new Rollbar({
    accessToken: Config.rollbarToken,
  });

  logger.on('logged', (level, message) => {
    if (Config.rollbarLevels.indexOf(level) > -1) {
      rollbar.error(message, () => {
        if (killOnNextLog) {
          process.exit(1);
        }
      });
    }

swagger2

Typescript-based tools for working with Swagger v2.0 documents

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis

Popular swagger2 functions