45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { apm } from './core/apm';
|
|
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() {
|
|
if (apm.isStarted()) {
|
|
console.log('apm start');
|
|
}
|
|
|
|
const app = await NestFactory.create(AppModule);
|
|
|
|
// app.setGlobalPrefix('api/v1');
|
|
app.setGlobalPrefix('api');
|
|
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);
|
|
SwaggerModule.setup('api/pos/docs', app, document, options);
|
|
|
|
await app.listen(process.env.PORT || 3000);
|
|
}
|
|
bootstrap();
|