Files
fabric_trade_server/dist/main.js
T

34 lines
1.3 KiB
JavaScript
Raw Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@nestjs/core");
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const app_module_1 = require("./app.module");
async function bootstrap() {
const app = await core_1.NestFactory.create(app_module_1.AppModule);
app.setGlobalPrefix('api');
app.enableCors({
origin: true,
credentials: true,
});
app.useGlobalPipes(new common_1.ValidationPipe({
whitelist: true,
transform: true,
forbidNonWhitelisted: true,
transformOptions: { enableImplicitConversion: true },
}));
const swaggerConfig = new swagger_1.DocumentBuilder()
.setTitle('Fabric Trade API')
.setDescription('API سرور تجارت پارچه')
.setVersion('1.0')
.addBearerAuth()
.build();
const document = swagger_1.SwaggerModule.createDocument(app, swaggerConfig);
swagger_1.SwaggerModule.setup('api/docs', app, document);
const port = process.env.PORT ?? 3000;
await app.listen(port);
console.log(`Fabric Trade API listening on http://localhost:${port}/api`);
console.log(`Swagger docs at http://localhost:${port}/api/docs`);
}
bootstrap();
//# sourceMappingURL=main.js.map