nestjs 4

Global Pipes

- 설치 yarn add class-validator class-transformer - main.ts에 GlobalPipes 설정 app.useGlobalPipes(new ValidationPipe()); ++ dto 제약/필터 걸기 // 이렇게 dto 같은거에 제약/필터 걸 수 있음. // 영어로 응답이 가고, 해당 키의 값으로 알리다보니 front에서 바로 쓰기에는 제약이 있음.. export class TestInput { @IsNotEmpty() user_id: string; } ++ 추가적인 공부 필요함. https://docs.nestjs.com/faq/request-lifecycle Documentation | NestJS - A progressive Node.js framework Nes..

코딩/Nest.js 2024.04.22

환경변수 ConfigModule

- 설치 yarn add @nestjs/config - import ConfigModule.forRoot(), - 환경변수 위치를 지정하거나, 다른 모듈에서도 사용할 수 있도록 글로벌 설정할 경우 ConfigModule.forRoot({ isGlobal: true, envFilePath: './env/.dev.env', }), https://docs.nestjs.com/techniques/configuration#custom-env-file-path Documentation | NestJS - A progressive Node.js framework Nest is a framework for building efficient, scalable Node.js server-side applications. ..

코딩/Nest.js 2024.04.22