Wondering if anyone could help me out with this, as I'm new to NestJS.
I'm trying to use Redis in my existing NestJS service, rather than creating a separate microservice like Nest documents in their examples. When I import redis from node-redis it comes back as undefined.
token.service.ts
import { Injectable } from '@nestjs/common';
import { v4 as uuidv4 } from 'uuid';
import redis from 'redis';
@Injectable()
export class TokenService {
constructor() {
// create new redis client with default options
this.client = redis.createClient();
this.client.on('error', err => console.error(err));
}
...
}
The error I'm getting: Cannot read property 'createClient' of undefined
I've never seen undefined imports in Node, so I'm wondering if this a NestJS specific issue, or if it has to do with the redis package I'm using.
Any help is appreciated.