Necromancers Playing MTG
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

yeps-redis

1.0.1 • Public • Published

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:

install

npm i yeps-redis

Downloadsweekly downloads

18

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability