34 lines
996 B
TypeScript
34 lines
996 B
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { AppModule } from './app.module';
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
import { DocumentBuilder, SwaggerCustomOptions, SwaggerModule } from '@nestjs/swagger';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule);
|
|
|
|
app.setGlobalPrefix('api/v1');
|
|
app.enableCors();
|
|
app.useGlobalPipes(
|
|
new ValidationPipe({ transform: true, forbidUnknownValues: false }),
|
|
);
|
|
|
|
const config = new DocumentBuilder()
|
|
.setTitle('Skyworld POS')
|
|
.setDescription('POS API Documentation')
|
|
.setVersion('1.0')
|
|
.addBearerAuth(
|
|
{ type: 'http', scheme: 'bearer', bearerFormat: 'JWT' },
|
|
'JWT',
|
|
)
|
|
.build();
|
|
|
|
const options: SwaggerCustomOptions = {
|
|
swaggerOptions: { docExpansion: 'list' },
|
|
};
|
|
const document = SwaggerModule.createDocument(app, config);
|
|
SwaggerModule.setup('api/v1/pos/docs', app, document, options);
|
|
|
|
await app.listen(process.env.PORT || 3000);
|
|
}
|
|
bootstrap();
|