Bot
This commit is contained in:
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const common_1 = require("@nestjs/common");
|
||||
const core_1 = require("@nestjs/core");
|
||||
const config_1 = require("@nestjs/config");
|
||||
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);
|
||||
const config = app.get(config_1.ConfigService);
|
||||
app.setGlobalPrefix('api');
|
||||
app.useGlobalPipes(new common_1.ValidationPipe({
|
||||
whitelist: true,
|
||||
transform: true,
|
||||
forbidNonWhitelisted: true,
|
||||
}));
|
||||
app.enableCors();
|
||||
const swaggerEnabled = config.get('SWAGGER_ENABLED') === 'true';
|
||||
if (swaggerEnabled) {
|
||||
const swaggerConfig = new swagger_1.DocumentBuilder()
|
||||
.setTitle('RayLab Core API')
|
||||
.setDescription('RayLab Core REST API')
|
||||
.setVersion('1.0.0')
|
||||
.addBearerAuth()
|
||||
.build();
|
||||
const document = swagger_1.SwaggerModule.createDocument(app, swaggerConfig);
|
||||
swagger_1.SwaggerModule.setup('docs', app, document);
|
||||
}
|
||||
const port = config.get('PORT') || 3000;
|
||||
await app.listen(port);
|
||||
console.log(`Server running on http://localhost:${port}`);
|
||||
}
|
||||
bootstrap();
|
||||
//# sourceMappingURL=main.js.map
|
||||
Reference in New Issue
Block a user