INNER CODE UNIT · TypeScript
bootstrap
Braineanear/EcommerceAPI · monolithic/src/main.ts:11
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const logger = new Logger();
const configService = app.get(ConfigService);
const env = configService.get<string>('app.env');
const schema = {
production: configService.get<string>('app.productionURL'),
staging: configService.get<string>('app.stagingURL'),
development: configService.get<string>('app.developmentURL'),
local: configService.get<string>('app.localURL'),
};
const options = new DocumentBuilder()
.setTitle('API')
.setVersion('0.0.1')
.addBearerAuth()
.addServer(schema[env])
.build();
const document = SwaggerModule.createDocument(app, options);