Req.session cannot get

  node.js, question

Here I am again … I want to save Access_token in the session after I get it. The following step is obtained.

router.route("/fanfou").get(function(req,res){
 res.render("fanfou",{title:'fanfou'});
 }).post(function(req,res){
 var username = req.body.username;
 var password= req.body.password;
 oa.getXAuthAccessToken(username, password, function (error, oauth_token, oauth_token_secret, results) {
 if (error)
 console.log(error);
 else
 bracket
 req.session.oauth_token = oauth_token;
 req.session.oauth_token_secret = oauth_token_secret;
 var options={
 url:'http://api.fanfou.com/statuses/home_timeline.json',
 oauth_token:req.session.oauth_token,
 oauth_token_secret:req.session.oauth_token_secret
 bracket
 oa.get(options,function(error,data){
 if(error)
 bracket
 res.json({
 error:error
 });
 bracket
 else{
 res.json({
 result:data,
 auth_token:req.session.oauth_token
 });
 bracket
 });
 bracket
 });
 });

But in this step, we can’t get it. I don’t know where the problem is, please advise the great god.

router.route("/fanfouget").get(function(req,res){
 res.render("fanfouget",{title:'fanfouget'});
 }).post(function(req,res){
 Log ('req.session.oauth_token' plus request.session.oauth _ token)
 var options={
 url:'http://api.fanfou.com/favorites/id.json',
 oauth_token:req.session.oauth_token,
 oauth_token_secret:req.session.oauth_token_secret
 bracket
 oa.get(options,function(error,data){
 if(error)
 bracket
 res.json({
 error:error
 });
 console.log(error);
 bracket
 else{
 res.json({
 result:data
 });
 console.log(data);
 bracket
 });
 });

Moreover, I added this code in app.js to detect req.session, but it has not been detected.

app.use('/',function(req,res){
 Res.send ('Test token');
 if(req.session.oauth_token){
 Log ('token exists');
 }else{
 req.session.oauth_token=11112;
 console.log(req.session.oauth_token);
 bracket
 })

Req.session relies on middleware, and expresjs does not provide this object by default.

If it is confirmed that the session middleware has been loaded, the debug log of the session can be opened through the environment variable.

DEBUG=express-session node app.js

Js is just a start signal.