nodejs笔记

  • 获取客户端IP地址
req.headers['x-forwarded-for'] || req.connection.remoteAddress
  • 删除url中多余的/符号
req.url.replace(/(/)1+/g,'$1').replace(/^/|/$/g,'')
原文地址:https://www.cnblogs.com/zh33gl/p/10369223.html