app.use(cookieParser()); app.use(session({
keys: ['key1’, ‘key2’],
secureProxy: true }));
app.use(function(req,res,next){ var again = req.query.again||false;
var n = req.session.views || 0
req.session.views = ++n
***console.log(n); // n 值永远是1 ***
if(req.session.curruser){
res.render('login/loginsuccess’,{loginname:loginname,password:password});
}
else{
res.render('login/login’,{again:again});
};
})
app.listen(3000);