How to use the swagger-express-ts.express function in swagger-express-ts

To help you get started, we’ve selected a few swagger-express-ts 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 dimeloper / ts-simple-backend / server / app.ts View on Github external
public config(): void {
    // use json form parser middlware
    this.app.use(bodyParser.json());

    // use query string parser middlware
    this.app.use(
      bodyParser.urlencoded({
        extended: false,
      }),
    );

    this.app.use(swagger.express(
      {
        definition: {
          externalDocs: {
            url: 'Typescript Seed URL'
          },
          info: {
            title: 'Typescript Seed API',
            version: '1.0'
          }
        }
      }
    ));
  }
github olivierlsc / swagger-express-ts / src / index.ts View on Github external
server.setConfig((app: any) => {
    app.use('/api-docs/swagger', express.static('swagger'));
    app.use(
        '/api-docs/swagger/assets',
        express.static('node_modules/swagger-ui-dist')
    );
    app.use(bodyParser.json());
    app.use(
        swagger.express({
            definition: {
                info: {
                    title: 'My api',
                    version: '1.0',
                },
                models: {
                    ApiError: {
                        properties: {
                            code: {
                                type:
                                    SwaggerDefinitionConstant.Model.Property
                                        .Type.STRING,
                                example: ['400'],
                            },
                            message: {
                                type: