Skip to content

Commit 4d8a6ee

Browse files
committed
refactor: standardize string quotes and update CORS origin in main.ts
1 parent be72d5d commit 4d8a6ee

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

backend/src/main.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
import { NestFactory, Reflector } from '@nestjs/core';
2-
import { AppModule } from './app.module';
3-
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
1+
import { NestFactory, Reflector } from "@nestjs/core";
2+
import { AppModule } from "./app.module";
3+
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
44
// import { ApiKeyGuard } from './common/guards/api-key.guard';
5-
import { ValidationPipe } from '@nestjs/common';
5+
import { ValidationPipe } from "@nestjs/common";
66

77
async function bootstrap() {
88
const app = await NestFactory.create(AppModule);
99
// app.useGlobalGuards(new ApiKeyGuard(new Reflector()));
10-
const isProd = process.env.NODE_ENV === 'production';
10+
const isProd = process.env.NODE_ENV === "production";
1111
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
1212

1313
app.enableCors({
14-
origin: isProd ? ['https://github.pacar-ai.my.id'] : '*',
15-
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
14+
origin: isProd ? ["https://commitflow.space"] : "*",
15+
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
1616
credentials: true,
1717
});
1818

1919
const config = new DocumentBuilder()
20-
.setTitle('CommitFlow API')
21-
.setDescription('Dokumentasi API Otomatis dengan Swagger')
22-
.setVersion('1.0')
20+
.setTitle("CommitFlow API")
21+
.setDescription("Dokumentasi API Otomatis dengan Swagger")
22+
.setVersion("1.0")
2323
.addBearerAuth() // jika pakai JWT atau header auth
2424
.build();
2525

2626
const document = SwaggerModule.createDocument(app, config);
27-
SwaggerModule.setup('docs', app, document);
27+
SwaggerModule.setup("docs", app, document);
2828

29-
await app.listen(process.env.PORT || 3000, '0.0.0.0');
29+
await app.listen(process.env.PORT || 3000, "0.0.0.0");
3030
}
3131

3232
bootstrap();

0 commit comments

Comments
 (0)