Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including yeps-redis with all npm packages installed. Try it out:

var yepsRedis = require("yeps-redis")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

yeps-redis v1.0.1

YEPS promise based redis client

YEPS ioredis

YEPS Promise based redis client

NPM

npm version Build Status Coverage Status Linux Build Windows Build

Dependency Status devDependency Status NSP Status

License GitHub stars GitHub forks GitHub issues Twitter

How to install

npm i -S yeps-redis

How to use

Config

config/default.json

{
  "redis": {
    "host": "127.0.0.1",
    "port": 6379
  }
}

Middleware

const App = require('yeps');
const Router = require('yeps-router');

const redis = require('yeps-redis');

const error = require('yeps-error');
const logger = require('yeps-logger');

const server = require('yeps-server');

const app = new App();
const router = new Router();

app.all([
    error(),
    logger(),
    redis(),
]);

app.then(async ctx => {
    await ctx.redis.set('data', 'test');
    const data = await ctx.redis.get('data');
});

router.get('/url').then(async ctx => {
    await ctx.redis.set('data', 'test');
    const data = await ctx.redis.get('data');
    
    ctx.res.statusCode = 200;
    ctx.res.end(data); 
});

app.then(router.resolve());

server.createHttpServer(app);

Module

const redis = require('yeps-redis/redis');

async () => {
    await redis.set('test', 'test');
    const data = await redis.get('test');
}

YEPS documentation

Dependencies:

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free