node.js - Node, Express 3: Track last user visit when req.session loaded from cookieSession -


i'm using nodejs , express 3. "permanently" remember user's login i'm setting non-expiring cookie this...

app.configure(function(){         ..         app.use(express.cookiesession({cookie:{path:'/',httponly:true,maxage:null},secret:'mysecrettt'}));  }); 

this works fine, , req.session automatically created when user returns.

however, i'd detect date/time when user return track last visit. how can accomplish this? thanks.

can't store last visit in session:

 app.all('*', function findlastvisit(req, res, next) {   if (req.session.visited)     req.lastvisit = req.session.visited;    req.session.visited = date.now();    next(); }); 

this retrieve previous last visit , store current date (that next last visit). can decide when consider user starts new visit (not on routes in example).

hope helps


Comments