49 lines
2.1 KiB
JavaScript
49 lines
2.1 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
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 helmet_1 = __importDefault(require("helmet"));
|
|
const app_module_1 = require("./app.module");
|
|
async function bootstrap() {
|
|
const app = await core_1.NestFactory.create(app_module_1.AppModule, {
|
|
logger: ['error', 'warn', 'log', 'debug', 'verbose'],
|
|
});
|
|
const httpAdapter = app.getHttpAdapter();
|
|
if (httpAdapter && httpAdapter.getInstance && typeof httpAdapter.getInstance().set === 'function') {
|
|
httpAdapter.getInstance().set('trust proxy', 1);
|
|
}
|
|
app.use((0, helmet_1.default)());
|
|
app.enableCors({
|
|
origin: process.env.ALLOWED_ORIGINS
|
|
? process.env.ALLOWED_ORIGINS.split(',')
|
|
: ['http://localhost:3204', 'http://localhost:5173', 'https://map-saas.intaleqapp.com'],
|
|
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
|
|
credentials: true,
|
|
});
|
|
app.setGlobalPrefix('api');
|
|
app.useGlobalPipes(new common_1.ValidationPipe({
|
|
whitelist: true,
|
|
forbidNonWhitelisted: true,
|
|
transform: true,
|
|
}));
|
|
const config = new swagger_1.DocumentBuilder()
|
|
.setTitle('Jordan Map Platform API')
|
|
.setDescription('Backend API for map services, routing, and driver telemetry for Jordan')
|
|
.setVersion('1.0')
|
|
.addApiKey({ type: 'apiKey', name: 'x-api-key', in: 'header' }, 'x-api-key')
|
|
.addTag('maps')
|
|
.addTag('geocoding')
|
|
.addTag('telemetry')
|
|
.build();
|
|
const document = swagger_1.SwaggerModule.createDocument(app, config);
|
|
swagger_1.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();
|
|
//# sourceMappingURL=main.js.map
|