Skip to content

t49tran/koa-redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koa-redis

koa-redis is a redis middleware for koa@2, inspired by koa-mongo middleware https://github.com/nswbmw/koa-mongo. It's written in Typescript and support koa2 async / await syntax.

It provides a promisified wrapper for node-redis client using bluebird.

Usage

import koaRedis from 'dt-koa-redis';

app.use(koaRedis({
  host: '127.0.0.1',
  port: 6379,
  maxConnections: 100,
  minConnections: 1,
}));

app.use(async (ctx, next) => {
  try {

    const data = await ctx.redis.getAsync('test');
    const write = 'testing';

    await ctx.redis.setAsync('test_key',write);
  } catch(err) {
    debug(err);
  }
});

License

MIT

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published