On 24/06/2013 17:33, Saransh Mohapatra wrote:
> I am building an app using expressjs, I want to use sessions where
> session data is stored in server-side and the cookie only contains
> the encrypted key to it. I seen a lot of examples that express does
> the same. But my problem is that they seem to use express.session
> where as Express docs doesn't specify any such middleware right now.
> It has cookieSession and I am not very sure as to what kind of
> sessions it provides.
That's because it comes from connect:
http://www.senchalabs.org/connect/middleware-session.html
> I tried to search for the same, but could not find any suitable
> information, so this question. Please help me out. If it only
> cookie-based encryption and holds all the data in the cookie only.
> Than I just wanted to know is it safe enough to be used. I know it
> can't be tempered and all. But still I get a feeling that the best
> option is the one I mentioned above.
>
> If it the same as express session than I have one more question as to
> which session data-store should I use? I want it to be fast and also
> reliable(it doesn't get deleted). Basically my choice is between
> connect-redis and connect-mongo. Please help me out.
I'm using connect-mongo with something like:
app.use(express.cookieParser(config.secret));
if (config.database) {
var MongoStore = require('connect-mongo')(express);
app.use(express.session({store: new MongoStore({
url: config.database
})}));
}
J�r�my.