Skip to content

Commit e26220f

Browse files
authored
Revert CORS setup (#88)
1 parent 978f424 commit e26220f

1 file changed

Lines changed: 0 additions & 24 deletions

File tree

api/src/main.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,6 @@ function makeLogLevelList(): LogLevel[] {
1616
);
1717
}
1818

19-
function configureCors(app: NestExpressApplication, configService: ConfigService) {
20-
const environment = configService.get('NODE_ENV') || 'development';
21-
22-
if (environment === 'development') {
23-
app.enableCors({
24-
origin: true,
25-
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
26-
credentials: true,
27-
});
28-
console.log('CORS enabled for development environment');
29-
} else {
30-
const allowedOrigins = configService.get('ALLOWED_ORIGINS');
31-
app.enableCors({
32-
origin: allowedOrigins ? allowedOrigins.split(',') : false,
33-
methods: 'GET,HEAD,POST,OPTIONS',
34-
credentials: false,
35-
});
36-
console.log(`CORS configured for ${environment} environment`);
37-
}
38-
}
39-
4019
async function bootstrap() {
4120
const app = await NestFactory.create<NestExpressApplication>(
4221
AppModule,
@@ -53,9 +32,6 @@ async function bootstrap() {
5332
app.disable('x-powered-by');
5433
app.set('trust proxy', 1);
5534

56-
// Environment-aware CORS configuration
57-
configureCors(app, configService);
58-
5935
const port = configService.get('PORT') || 3000;
6036

6137
await app.listen(port);

0 commit comments

Comments
 (0)