0
我想知道這是否可以用Node.js和express.js完成。在我的傳入網址我有參數如。Node.js中的帶參數,然後添加到請求
http://localhost:8080/restaurant.html?siteid=7&locationid=8&companyid=7
我想提取的查詢,然後將其附加到任何傳入的請求
,這樣當客戶端代碼調用我的JSON和我的路由器發送請求到
app.get('/siteinfo.json', function(req, res) {
console.log(company, site , location);
getdata_hdlr.get_site_setup(company, site , location);
});
我可以將查詢參數傳遞給被調用的函數。
這樣做還是需要在我的客戶端代碼中執行此操作?
你讀過http://stackoverflow.com/questions/6912584/how-to-get-get-query-string-variables-in-node-js? –
[使用req.query](http://expressjs.com/api.html#req.query) – Smitha