
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
fastify-redis-mock
Advanced tools
Plugin to share a common Redis mock connection across Fastify.
Fastify Redis mock connection plugin, with this you can share the same Redis mock connection in every part of your server.
This package is useful if you wish to unittest your Fastify project, without the need to run Redis itself.
Full credit goes to the Fastify team for building fastify-redis, and stipsan for building ioredis-mock.
For documentation, please refer to either the Fastify-redis docs, or ioredis-mock docs.
npm i fastify-redis-mock --save
Add it to your project with register
and you are done!
You can access the Redis mock client via fastify.redis
.
const fastify = require('fastify')
const redis = require('fastify-redis')
const redisMock = require('fastify-redis-mock')
// Register the mock for e.g. unit tests
const redisInstance = process.env.ENVIRONMENT === 'unittest' ? redisMock : redis;
fastify.register(redisInstance, [options])
fastify.get('/foo', (req, reply) => {
const { redis } = fastify
redis.get(req.query.key, (err, val) => {
reply.send(err || val)
})
})
fastify.post('/foo', (req, reply) => {
const { redis } = fastify
redis.set(req.body.key, req.body.value, (err) => {
reply.send(err || { status: 'ok' })
})
})
fastify.listen(3000, err => {
if (err) throw err
console.log(`server listening on ${fastify.server.address().port}`)
})
This project is copied from:
Licensed under MIT.
FAQs
Plugin to share a common Redis mock connection across Fastify.
The npm package fastify-redis-mock receives a total of 865 weekly downloads. As such, fastify-redis-mock popularity was classified as not popular.
We found that fastify-redis-mock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.