File size: 864 Bytes
7b850b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5513d12
 
 
 
7b850b7
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import * as bodyParser from 'body-parser';
import { ValidationPipe } from '@nestjs/common';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  app.useGlobalPipes(new ValidationPipe());

  // Enable CORS for all origins and all methods
  app.enableCors({
    origin: '*', // Allow all origins
    // origin: ['https://property-fe-h8e2.vercel.app', 'http://localhost:3000'], // Replace with your frontend domain or use '*'
    methods: '*', // Allow all methods
    credentials: true,
  });

  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(bodyParser.json());

  // Use the PORT environment variable or default to 8080
  const port = process.env.PORT || 7860;
  
  await app.listen(port);
}
bootstrap();