32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
import { AppModule } from './app.module';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule);
|
|
|
|
// Enable CORS for frontend
|
|
// تفعيل تبادل الموارد مع الواجهة الأمامية
|
|
app.enableCors();
|
|
|
|
// Set global API prefix
|
|
app.setGlobalPrefix('api');
|
|
|
|
// Swagger Documentation Setup
|
|
const config = new DocumentBuilder()
|
|
.setTitle('Jordan Map Platform API')
|
|
.setDescription('Backend API for map services, routing, and driver telemetry for Jordan')
|
|
.setVersion('1.0')
|
|
.addTag('maps')
|
|
.addTag('telemetry') // Corrected line to add 'telemetry' tag
|
|
.build();
|
|
|
|
const document = SwaggerModule.createDocument(app, config);
|
|
SwaggerModule.setup('docs', app, document);
|
|
|
|
const port = process.env.API_PORT || 3000;
|
|
await app.listen(port);
|
|
console.log(`🚀 Jordan Map API is running on: http://localhost:${port}/api`);
|
|
}
|
|
bootstrap();
|