|
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"; |
4 | 4 | // import { ApiKeyGuard } from './common/guards/api-key.guard'; |
5 | | -import { ValidationPipe } from '@nestjs/common'; |
| 5 | +import { ValidationPipe } from "@nestjs/common"; |
6 | 6 |
|
7 | 7 | async function bootstrap() { |
8 | 8 | const app = await NestFactory.create(AppModule); |
9 | 9 | // app.useGlobalGuards(new ApiKeyGuard(new Reflector())); |
10 | | - const isProd = process.env.NODE_ENV === 'production'; |
| 10 | + const isProd = process.env.NODE_ENV === "production"; |
11 | 11 | app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true })); |
12 | 12 |
|
13 | 13 | 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"], |
16 | 16 | credentials: true, |
17 | 17 | }); |
18 | 18 |
|
19 | 19 | 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") |
23 | 23 | .addBearerAuth() // jika pakai JWT atau header auth |
24 | 24 | .build(); |
25 | 25 |
|
26 | 26 | const document = SwaggerModule.createDocument(app, config); |
27 | | - SwaggerModule.setup('docs', app, document); |
| 27 | + SwaggerModule.setup("docs", app, document); |
28 | 28 |
|
29 | | - await app.listen(process.env.PORT || 3000, '0.0.0.0'); |
| 29 | + await app.listen(process.env.PORT || 3000, "0.0.0.0"); |
30 | 30 | } |
31 | 31 |
|
32 | 32 | bootstrap(); |
0 commit comments