Closed Zireael26 closed 1 year ago
This would do:
import fp from 'fastify-plugin'
import fastifyRedis, { FastifyRedisPluginOptions } from '@fastify/redis'
/**
* This plugins enables redis support
*
* @see https://github.com/fastify/fastify-redis
*/
export default fp<FastifyRedisPluginOptions>(async (fastify) => {
await fastify.register(fastifyRedis, {
host: 'localhost',
port: 6379,
db: 0,
autoResendUnfulfilledCommands: true,
closeClient: true,
// enableReadyCheck: true,
// autoResubscribe: true,
});
})
Prerequisites
Fastify version
^4.0.0
Plugin version
^6.1.0
Node.js version
18
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
12.6.1
Description
After registering the plugin with fastify like so:
src/plugins/redis.ts
When I try to use it in my file
src/services/RedisService.ts
like so:gives me the error
I have been trying for a while now, and have tried multiple things.
Steps to Reproduce
Expected Behavior
The redis function is called and appropriate action is executed.