正在显示
3 个修改的文件
包含
14 行增加
和
5 行删除
1 | 1 | ||
2 | // # boot - sessions | 2 | // # boot - sessions |
3 | 3 | ||
4 | -var session = require('express-session') | ||
5 | -var RedisStore = require('connect-redis')(session) | 4 | +var session = require('express-session'); |
5 | +var RedisStore = require('connect-redis').default; | ||
6 | +var createClient = require('redis'); | ||
6 | 7 | ||
7 | exports = module.exports = function(logger, settings) { | 8 | exports = module.exports = function(logger, settings) { |
8 | 9 | ||
9 | - var connection = new RedisStore(settings.redis) | 10 | + // Initialize client. |
11 | + let redisClient = createClient() | ||
12 | + redisClient.connect().catch(console.error) | ||
13 | + | ||
14 | + var connection = new RedisStore({ | ||
15 | + client: redisClient, | ||
16 | + ...settings.redis | ||
17 | + }) | ||
10 | 18 | ||
11 | connection.on('error', function(err) { | 19 | connection.on('error', function(err) { |
12 | logger.error('redis connection error: %s', err.message || err) | 20 | logger.error('redis connection error: %s', err.message || err) |
package-lock.json
0 → 100644
此 diff 太大无法显示。
@@ -31,11 +31,12 @@ | @@ -31,11 +31,12 @@ | ||
31 | "bootable": "^0.2.4", | 31 | "bootable": "^0.2.4", |
32 | "chalk": "^1.0.0", | 32 | "chalk": "^1.0.0", |
33 | "commander": "^2.8.1", | 33 | "commander": "^2.8.1", |
34 | - "connect-redis": "~2.3.0", | 34 | + "connect-redis": "~7.1.1", |
35 | "email-templates": "^1.2.1", | 35 | "email-templates": "^1.2.1", |
36 | - "express-session": "^1.11.2", | 36 | + "express-session": "^1.18.0", |
37 | "merge-defaults": "^0.2.1", | 37 | "merge-defaults": "^0.2.1", |
38 | "nodemailer": "^1.3.4", | 38 | "nodemailer": "^1.3.4", |
39 | + "redis": "^4.6.9", | ||
39 | "slack-winston": "^0.0.2", | 40 | "slack-winston": "^0.0.2", |
40 | "to-camel-case": "^0.2.1", | 41 | "to-camel-case": "^0.2.1", |
41 | "underscore": "^1.8.3", | 42 | "underscore": "^1.8.3", |
请
注册
或
登录
后发表评论