Module for using Redisk in NestJS.
npm install redisk-nestjs redisk --save
import { Module } from '@nestjs/common';
import { RediskModule } from 'redisk-nestjs';
@Module({
imports: [
RediskModule.forRoot({
host: '127.0.0.1',
port:6379,
db:0
}),
],
})
export class AppModule {}
import { Controller, Get } from '@nestjs/common';
import { Redisk } from 'redisk';
@Controller('cats')
export class CatsController {
constructor(private readonly redisk: Redisk) {}
@Get()
async findAll(): Promise<Cat[]> {
return this.redisk.list<Cat>(Cat);
}
}