Skip to content

Commit 1925c0a

Browse files
Fix CORS for Codesignal preview and set backend port 3001
1 parent ceebfc2 commit 1925c0a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ import { LogsService } from './common/logging/logs.service';
1111

1212
async function bootstrap() {
1313
const app = await NestFactory.create<NestExpressApplication>(AppModule);
14-
app.enableCors({ origin: '*', credentials: true });
14+
app.enableCors({
15+
origin: [
16+
'http://localhost:3000',
17+
/\.preview\.codesignal\.dev$/, // allow any Codesignal preview frontend
18+
],
19+
credentials: true,
20+
});
21+
1522
app.useGlobalPipes(
1623
new ValidationPipe({
1724
transform: true,
@@ -35,7 +42,8 @@ async function bootstrap() {
3542
res.sendFile(join(publicDir, 'index.html')),
3643
);
3744

38-
const port = Number(process.env.PORT) || 3000;
45+
const port = Number(process.env.PORT) || 3001;
46+
3947
await app.listen(port);
4048
console.log(`Application is running on: http://localhost:${port}`);
4149
}

0 commit comments

Comments
 (0)