node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

Documentation missing for exporting connection from one module and using it from other module

Open rajiff opened this issue 4 years ago • 0 comments

Documentation is missing for more practical scenarios as examples

Such as: Initialise connection in a particular module and export it, use the same in other modules for executing commands on redis

  • without this we will endup creating multiple connections
  • without this node-redis is forcing clients too to become async/await based methods
  • with async/await now we have to chain premisses and code readability is going away (I agree we can avoid it with bit of coding work around using then but in v3 it was more elegant and we could avoid nested then easily, now it is upto the developer's skill, like this we have to review code of all our programmers each time)

Eg: connectClient.js : In this create and initialise connections (such as connection URL and other options)

someOtherModule.js: In this want to use the connection earlier initialised in connectClient.js

Environment:

  • Node.js Version: NodeJS 12 and above
  • Redis Server Version: 6.2 and above
  • Node Redis Version: 4 and above
  • Platform: All OSes

rajiff avatar Dec 21 '21 08:12 rajiff