您好。当我在UI中打印req.session.mySessValue时,该值为空。我认为req.session.mySessValue = dt.myValue的分配; (快递会)不合适。谁能帮助我呢?在此先感谢。我的快递代码是
router.get('/', function(req, res, next) {
if(!req.xx) {
return res.redirect('/firstView');
}
var options = {
.......
};
var call = http.request(options, function(resp) {
resp.on('data', function(dt) {
var jsondata = JSON.parse(dt);
req.session.mySessValue = dt.myValue;
});
});
call.end();
call.on('error', function(e) {
console.log("error" +e.message)
});
var v = {
title: 'sample',
req : req
}
res.render('myview', v);
});