Files
api/src/main.ts
T

33 lines
849 B
TypeScript
Raw Normal View History

2026-07-23 10:25:32 +03:30
import { NestFactory } from '@nestjs/core';
import { RequestMethod, ValidationPipe } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const config = app.get(ConfigService);
app.setGlobalPrefix('api', {
exclude: [{ path: 'get_user', method: RequestMethod.GET }],
});
app.enableCors({
origin: config.get<string>('CORS_ORIGIN', 'http://localhost:5173'),
credentials: true,
});
app.useGlobalPipes(
new ValidationPipe({
whitelist: true,
transform: true,
forbidNonWhitelisted: true,
}),
);
const port = Number(config.get('PORT') ?? 3001);
await app.listen(port);
console.log(`SuperAdmin API listening on http://localhost:${port}`);
}
bootstrap();