Skip to content

Plugin to share a common Redis connection across Fastify

License

Notifications You must be signed in to change notification settings

Techie-Qabila/fastify-ioredis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastify-ioredis

js-standard-style

Fastify ioredis connection plugin, with this you can share the same Redis connection in every part of your server.

Under the hood the ioredis client is used, the options that you pass to register will be passed to the Redis client.

Install

npm i fastify-ioredis --save

Usage

Add it to you project with register and you are done!
You can access the Redis client via fastify.redis.client.

const fastify = require('fastify')

fastify.register(require('fastify-ioredis'), {
  host: '127.0.0.1'
}, err => {
  if (err) throw err
})

fastify.listen(3000, err => {
  if (err) throw err
  console.log(`server listening on ${fastify.server.address().port}`)
})

License

Licensed under MIT.

About

Plugin to share a common Redis connection across Fastify

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published