chore(api): scaffold NestJS application
This commit is contained in:
1 parent
7a2b0a15d7
commit
05565f5a44
14 files changed
+378
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule, {
|
||||
rawBody: true,
|
||||
});
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'dev';
|
||||
const webOrigins = process.env.WEB_ORIGIN?.split(',').map((origin) =>
|
||||
origin.trim(),
|
||||
) ?? [
|
||||
'http://localhost:5173',
|
||||
'http://126.dahyeon.us:5173',
|
||||
'https://lolympus.dahyeon.us',
|
||||
];
|
||||
|
||||
app.enableCors({
|
||||
origin: isDev ? true : webOrigins,
|
||||
credentials: true,
|
||||
allowedHeaders: ['Authorization', 'Content-Type', 'X-Auth-User-Id'],
|
||||
});
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
transform: true,
|
||||
transformOptions: { enableImplicitConversion: false },
|
||||
}),
|
||||
);
|
||||
await app.listen(isDev ? 3000 : 10712);
|
||||
}
|
||||
bootstrap();
|
||||
Reference in new issue
Block a user