Skip to content

Instantly share code, notes, and snippets.

@nmchenry01
Created August 24, 2020 12:09
Show Gist options
  • Select an option

  • Save nmchenry01/b2e47c6f1d40632653373f9e28f3556a to your computer and use it in GitHub Desktop.

Select an option

Save nmchenry01/b2e47c6f1d40632653373f9e28f3556a to your computer and use it in GitHub Desktop.
Bootstrap with swagger "NestJS with Swagger"
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const APP_NAME = process.env.npm_package_name;
const APP_VERSION = process.env.npm_package_version;
const options = new DocumentBuilder()
.setTitle(APP_NAME)
.setDescription(`The ${APP_NAME} API description`)
.setVersion(APP_VERSION)
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('swagger', app, document);
await app.listen(3000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment