Tuesday, 17 September 2013

nodejs express 3 framework session destroying issue

nodejs express 3 framework session destroying issue

I'm using nodejs with Express 3 framework and I have an issue with
deleting one specific session, here is the code I'm using :
app.js
var express = require('express');
................
................
app.use(express.cookieParser());
app.use(express.session({secret : 'asxcfrgth'}));
app.use(app.router);
app.get('/User', function(req, res){
req.session.login = "Invalid username";
req.session.password= "Invalid password";
console.log(req.session.login);
console.log(req.session.password);
req.session.destroy();
});
req.session.destroy will delete all my sessions so is there a way to only
destroy the first session and leave the second one? I want to avoid using
this :
req.session.login ="";
to empty the session variable, Thanks.

No comments:

Post a Comment