mardi 24 février 2015

How to properly setup redis for session store

I am trying to setup Redis Store like this:



var express = require('express');
var app = express();
.......
.......
var session = require('express-session');
var redis = require("redis").createClient();
var RedisStore = require("connect-redis")(session);

app.use(session({
store: new RedisStore({
host: 'localhost',
port: 6379,
client: redis
}),
secret: 'keyboard cat'
}));


But using like this the passport.js wont work and the express-flash will throw an error: `Error: req.flash() requires sessions.


I believe Redis is not working at all.


I am very confuse with the configuration also, should i put localhost in the host key? I am using Cloud 9, not my localhost.


What i am doing wrong?


Aucun commentaire:

Enregistrer un commentaire