Hapi plugin that provides a shared Redis connection across the entire Hapi server. Current stable version is 6.0.0, designed for hapi v8.x.x. Supports connection via URL string or object, allows multiple plugin registrations, and optionally accepts a custom redis library. Key differentiators: simple integration with hapi's plugin system, automatic connection handling, and support for the `hiredis` parser without additional configuration.
npm install hapi-redisNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Registers hapi-redis plugin with custom host/port, defines a route that uses the shared Redis client.
Wrap options in { connection: { host: ..., port: ..., opts: ... } }Upgrade to hapi-redis@3.0.1 or later
Pass desired redis module via { redisLibrary: require('redis') } in optionsWrap server.register in try/catch or handle error callback.
Define routes inside the server.register callback.
Access client inside server.register callback: request.server.plugins['hapi-redis'].client
Start Redis server or provide correct host/port in options.
Upgrade to hapi-redis@3.x.x which supports multiple registrations, or avoid double registration.