34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
import { AdminModule } from './admin.module';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AdminModule);
|
|
|
|
// Global prefix for admin APIs; mobile client endpoints excluded
|
|
app.setGlobalPrefix('api/v1', {
|
|
exclude: ['api/app/version/(.*)'],
|
|
});
|
|
|
|
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
|
|
app.enableCors();
|
|
|
|
// Swagger documentation
|
|
const config = new DocumentBuilder()
|
|
.setTitle('Genex Admin Service')
|
|
.setDescription('Mobile app version management & OTA updates')
|
|
.setVersion('1.0.0')
|
|
.addBearerAuth()
|
|
.addTag('app-version', 'Mobile client check-update & download')
|
|
.addTag('admin-versions', 'Admin version management')
|
|
.build();
|
|
SwaggerModule.setup('docs', app, SwaggerModule.createDocument(app, config));
|
|
|
|
const port = parseInt(process.env.PORT || '3012', 10);
|
|
await app.listen(port);
|
|
console.log(`[admin-service] Running on http://localhost:${port}`);
|
|
console.log(`[admin-service] Swagger docs at http://localhost:${port}/docs`);
|
|
}
|
|
bootstrap();
|