mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-22 15:14:48 +00:00
34 lines
890 B
TypeScript
34 lines
890 B
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
import { writeFileSync } from 'fs';
|
|
import helmet from 'helmet';
|
|
|
|
import { AppModule } from './app.module';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule, {
|
|
cors: {
|
|
origin: '*',
|
|
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
|
preflightContinue: false,
|
|
optionsSuccessStatus: 204,
|
|
},
|
|
});
|
|
|
|
app.use(helmet());
|
|
|
|
const config = new DocumentBuilder()
|
|
.setTitle('Maestro Grpc Documentation')
|
|
.setDescription('Documentation for Maestro gateway')
|
|
.setVersion('1.0')
|
|
.addBearerAuth()
|
|
.build();
|
|
|
|
const document = SwaggerModule.createDocument(app, config);
|
|
writeFileSync('./swagger.json', JSON.stringify(document));
|
|
SwaggerModule.setup('api', app, document);
|
|
|
|
await app.listen(3333);
|
|
}
|
|
bootstrap();
|