简体   繁体   中英

How can i get user id serverside?

I am making a node.js application with express and i need to get user ID. I need something like "req.userID", to use like that:

var counter=0;
var user = new Array();

router.get("/", function(req, res) {
 var aux=0;
 user.forEach(i => { 
  if(i != req.userID)
   var aux++;
  else console.log("User exist!");
  if(aux === user.length)
   user.push(req.userID);
 })

});

“req.connection.remoteAddress”谢谢ObsoleteAwareProduce,这正是我要找的:D

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM