npm.io
0.7.9 • Published 2 years ago

@types/swagger-restify-mw

Licence
MIT
Version
0.7.9
Deps
1
Size
5 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/swagger-restify-mw

Summary

This package contains type definitions for swagger-restify-mw (https://github.com/apigee-127/swagger-restify#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/swagger-restify-mw.

index.d.ts

/* =================== USAGE ===================
import * as SwaggerRestify from "swagger-restify-mw";
import * as restify from "restify";

let app = restify.createServer();

let config = {
  appRoot: __dirname // required config
} as SwaggerRestify.Config;

SwaggerRestify.create(config, function(err, swaggerRestify) {
  if (err) { throw err; }

  swaggerRestify.register(app);

  let port = process.env.PORT || 10010;
  app.listen(port);

  if (swaggerRestify.runner.swagger.paths['/hello']) {
    console.log('try this:\ncurl http://127.0.0.1:' + port + '/hello?name=Scott');
  }
});

 =============================================== */

import { Config, RestifyMiddleware } from "swagger-node-runner";

/** export interfaces */
export { Config, RestifyMiddleware } from "swagger-node-runner";

/**
 * Create a new instance of a Restify specific `SwaggerNodeRunner` middleware
 *
 * The `swagger-node-runner` module has the following config priority:
 *   1. `swagger_*` environment vars
 *   2. `config` passed to `create()`
 *   3. read from swagger node in `default.yaml` in config directory
 *   4. module defaults
 *
 * @see @link{https://github.com/apigee-127/swagger-express|Github}
 */
export function create(config: Config, cb: (err: Error | undefined, middleware: RestifyMiddleware) => void): void;

Additional Details

Credits

These definitions were written by Michael Mrowetz.