Advertisement
nodejsdeveloperskh

config swagger in nestjs

Sep 13th, 2021
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (appConfigs.nodeEnv === NodeEnv.development) {
  2.     const options = new DocumentBuilder()
  3.     .setTitle('document-title')
  4.     .setDescription('A short description.')
  5.     .setVersion('1.0')
  6.     .addBearerAuth({
  7.         type: 'apiKey',
  8.         in: 'header',
  9.         name: 'authorization',
  10.     })
  11.     .build();
  12.     const document = SwaggerModule.createDocument(app, options);
  13.     SwaggerModule.setup(
  14.         configService.get('SWAGGER_ROUTE'),
  15.         app,
  16.         document,
  17.     );
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement