dt-koa-redis
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -52,2 +52,4 @@ "use strict"; | ||
var generic_pool_1 = require("generic-pool"); | ||
var bluebird_1 = require("bluebird"); | ||
bluebird_1.Promise.promisifyAll(redis_1.RedisClient.prototype); | ||
var debug = require('debug')('redis'); | ||
@@ -54,0 +56,0 @@ var defaultOptions = { |
{ | ||
"name": "dt-koa-redis", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Redis middleware for koa2", | ||
@@ -16,2 +16,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"bluebird": "^3.7.2", | ||
"debug": "^4.3", | ||
@@ -25,2 +26,3 @@ "generic-pool": "^3.1", | ||
"devDependencies": { | ||
"@types/bluebird": "3.5.35", | ||
"@types/generic-pool": "3.1.9", | ||
@@ -27,0 +29,0 @@ "@types/koa": "2.13.1", |
## koa-redis | ||
koa-redis is a mongodb middleware for koa@2, using redis and bluebird, support connection pool, inspired by koa-mongo middleware https://github.com/nswbmw/koa-mongo. It's written in Typescript and support koa2 async / await syntax. | ||
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](https://github.com/NodeRedis/node-redis) client using bluebird. | ||
### Usage | ||
@@ -16,14 +18,3 @@ | ||
})); | ||
``` | ||
### Example | ||
``` | ||
'use strict'; | ||
import koa from 'koa'; | ||
import koaRedis from 'dt-koa-redis'; | ||
const app = new koa(); | ||
app.use(koaRedis()); | ||
app.use(async (ctx, next) => { | ||
@@ -40,6 +31,2 @@ try { | ||
}); | ||
app.listen(3000, () => { | ||
console.log('listening on port 3000'); | ||
}); | ||
``` | ||
@@ -46,0 +33,0 @@ |
import { createClient, RedisClient } from 'redis'; | ||
import { createPool } from 'generic-pool'; | ||
import { Context, Next } from 'koa'; | ||
import { Promise as PromiseLib } from 'bluebird'; | ||
PromiseLib.promisifyAll(RedisClient.prototype); | ||
const debug = require('debug')('redis'); | ||
@@ -53,2 +56,3 @@ | ||
}); | ||
client.on('ready', () => { | ||
@@ -55,0 +59,0 @@ resolve(client); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13008
244
0
5
7
35
+ Addedbluebird@^3.7.2
+ Addedbluebird@3.7.2(transitive)