koa-redis add support for v4.0 (#40578)

This commit is contained in:
Scotland Stephenson 2019-11-27 17:12:10 -05:00 committed by Andrew Casey
parent 50284197ae
commit 89648eb96c
2 changed files with 15 additions and 14 deletions

View File

@ -1,11 +1,12 @@
// Type definitions for koa-redis 3.0
// Type definitions for koa-redis 4.0
// Project: https://github.com/koajs/koa-redis
// Definitions by: Nick Simmons <https://github.com/nsimmons>
// Scotland Stephenson <https://github.com/alsoscotland>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { ClientOpts } from 'redis';
import { SessionStore } from 'koa-generic-session';
import { stores } from 'koa-session';
declare namespace redisStore {
interface RedisOptions extends ClientOpts {
@ -13,7 +14,7 @@ declare namespace redisStore {
client?: any;
}
interface RedisSessionStore extends SessionStore {
interface RedisSessionStore extends stores {
client: any;
}
}

View File

@ -1,20 +1,20 @@
import Koa = require("koa");
import { MemoryStore, Session } from "koa-generic-session";
import session = require("koa-generic-session");
import session = require("koa-session");
import redisStore = require("koa-redis");
const app = new Koa();
app.use(session({
store: redisStore({
url: 'redis://url:123',
host: 'redisHost',
port: 123,
path: 'redis/path',
db: '2',
duplicate: false,
client: {}
})
}));
url: 'redis://url:123',
host: 'redisHost',
port: 123,
path: 'redis/path',
db: '2',
duplicate: false,
client: {}
})
}, app
));
app.listen(80);