- 커스텀 파이프
import { BadRequestException, Injectable, PipeTransform } from "@nestjs/common";
@Injectable()
export class PasswordPipe implements PipeTransform {
transform(value: any): any {
if(value.toString().length < 8){
throw new BadRequestException('비밀번호는 8자 이상이어야 합니다.');
}
return value.toString();
}
}
'JS > Nest.js' 카테고리의 다른 글
[Nest] DI 실습 export service, import module, Nest can't resolve dependencies of the 해결, 게시글 생성제한 구현 (0) | 2024.09.20 |
---|---|
[Nest] Guard => req에 user 넣기, 로그인 과정 복습, 토큰 타입확인 (0) | 2024.09.20 |
[Nest] Jwt 토큰 재발급 구현 (0) | 2024.09.18 |
[Nest] base64 토큰 인증 구현 (0) | 2024.09.18 |
[Nest] JWT 토큰발급 구현, 외부 모듈 import-export 하는법 (0) | 2024.09.18 |