쿠키파서 에러
- 쿠키파서를 적용하기 위해 main.ts에 쿠키파서 모듈 설치 후 적용
//쿠키파서 모듈 추가
app.use(cookieParser());
app.useGlobalPipes(
new ValidationPipe({
whitelist: true,
transform: true,
transformOptions: {
enableImplicitConversion: true,
},
}),
);
- 서버실행시 쿠키파서 에러 발생
해결 방법
- import한 쿠키파서 모듈의 정의를
import cookieParser from 'cookie-parser';
- 아래 모듈로 재정의
import * as cookieParser from 'cookie-parser';
스택오버플로우 링크
NestJS: Adding cookie-parser causes an error
When I run this code: import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import cookieParser from 'cookie-parser'; async function bootstrap() { const app = await
stackoverflow.com
'개발일지' 카테고리의 다른 글
Nest.js socket.io (0) | 2023.11.20 |
---|---|
Nest.JS JWT토큰 발급 (0) | 2023.08.31 |
Nest.JS AWS S3 적용 (0) | 2023.08.20 |
Nest.JS 인터셉터 (0) | 2023.08.19 |
Nest.JS CQRS (0) | 2023.08.18 |