提交 2350b35783ea0c209df64eb29c84c2c9e38843dd

作者 fanwh
1 个父辈 a47a809d

no message

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)
此 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",
注册登录 后发表评论