我知道,如果我通过一个URL像下面:我可以使用ExpressJS遍历查询字符串参数吗?
http://localhost:3000/customer?companyid=300&customerid=200
那我就可以在ExpressJS使用下面来提取数据:
res.send(util.format('You are looking for company: %s customer: %s', req.query.companyid, req.query.customerid));
但是,我想遍历参数并处理它们,而不必在我的查询中预定义它们。我似乎无法找到快速API中的任何东西,似乎工作(可能看起来正确)。
http://localhost:3000/customer?companyid=300&customerid=200&type=employee
任何意见/建议,将不胜感激!
感谢,
小号
感谢@adamse ....我喜欢hasOwnProperty检查。 – scarpacci