I am a newcomer to using NestJS and currently utilizing it to manage a REST API server. My goal is to send some HTTP-only cookies in the response, so I referred to the official documentation for guidance. The documentation suggests using the cookie
method within the Response
object. However, upon implementing the code provided, I discovered that the cookie
method is not defined. Here is my code:
@Get('login')
verifyLoginEmailCode(
@Headers() { email, password }: LoginInputDto,
@Res({ passthrough: true }) res: Response,
) {
// According to the official documentation, res.cookie should be a function but it's not defined
console.log(Object.keys(res)); // "cookie" key is missing from the keys
return this.authAdminService.login(email, password);
}
Am I making any mistakes?