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

Popular posts from this blog

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -