Redis快递和护照

时间:2015-02-26 11:04:16

标签: node.js express

我正在尝试将Redis与我现有的应用程序一起使用

这是我的app.js代码

var express = require('express'),
  request = require('request'),
  http = require('http'),
  path = require('path');  
var app = express();
var routes = require('./routes');
var passport = require('passport');
var flash = require('connect-flash'); 
var cookieParser = require('cookie-parser');
var session = require('express-session');
var busboy = require('connect-busboy');
var policies = require('./policies/admin');
var config = require('./config');
 require('./libs/passport')(passport); 

 app.configure(function () { 
   app.use(express.session({ secret: 'secertkey', cookie: { maxAge : 2592000000 } })); // session secret
    app.use(passport.initialize());
    app.use(passport.session()); // persistent login sessions
});

哪个工作正常。

我想和护照一起使用Rediss,

这可能,我该怎么办

由于

1 个答案:

答案 0 :(得分:0)

将快速会话存储传递给connect-redis以创建RedisStore构造函数。

var session = require('express-session');
var RedisStore = require('connect-redis')(session);

app.use(session({
    store: new RedisStore(options),
    secret: 'keyboard cat'
}));

供参考 https://www.npmjs.com/package/connect-redis