人生最曼妙的风景,竟是内心的淡定与从容!
Obviously your username is not defined Try adding an if judgment to your second middleware
Just take it directly when you use it,
The two usernames are in different scopes, of course they are undefined...
These are the variables of two methods. The second one cannot refer to the username in the first method. Use req.session.username again and get it once.
Obviously your username is not defined
Try adding an if judgment to your second middleware
Just take it directly when you use it,
The two usernames are in different scopes, of course they are undefined...
These are the variables of two methods. The second one cannot refer to the username in the first method. Use req.session.username again and get it once.