Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@pager/hapi-redis
Advanced tools
A node-redis hapi plugin
npm install --save @pager/hapi-redis
This pretty much works as a regular node-redis client, with the addition of providing an easily accessible instance via the server.app
common namespace.
const Hapi = require('hapi');
const server = new Hapi.Server();
server.connection({ host: 'localhost' });
const options = {
// node-redis config options - http://redis.js.org/#api-rediscreateclient
};
// Register the plugin
server.register({
register: require('@pager/hapi-redis'),
options: options
}, (err) => {
if (err) {
console.error(err);
}
else {
server.start(() => {
console.info(`Server started at ${server.info.uri}`);
});
}
});
// Declare a route that uses it
server.route({
method: 'GET',
path: '/stats',
handler: usersHandler
});
usersHandler (request, reply) => {
// Access the redis instance
const client = request.redis;
client.hgetall('users', (err, obj) => {
if (err) {
throw err
}
return reply({ result: obj });
});
};
server.start(() => {
console.log(`Server started at ${server.info.uri}`);
});
You could use next promisified methods, e.g.:
const res = await getAsync(key);
Original method | Promisified method |
---|---|
set | setAsync |
get | getAsync |
flushall | flushallAsync |
quit | quitAsync |
keys | keysAsync |
ttl | ttlAsync |
To run the test suite, first install the dependencies, then run npm test
:
$ npm install
$ npm test
This module borrows heavily from hapi-ioredis.
FAQs
A redis hapi plugin
We found that @pager/hapi-redis demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.