0
如何使用apigee-access設置變量用於表達?如何在節點js中使用apigee-access設置變量?
我想用這樣的apigee訪問得到一個變量:
http.createServer(function(req, resp) {
var userId= apigee.getVariable(req,username);
resp.end('Hello, World!\n'+userId+' Error:'+err);
});
並嘗試使用該變量在userId的
app.post('/employees', function(req, res) {
if (!req.is('json')) {
res.jsonp(400, {
error : 'Bad request'
});
return;
}
var b = req.body;
var e = {
'userName' : userId,
'displayName' : userId+"_details",
'phone' : b.phone
};
createEmployee(e, req, res);
});
我收到一個錯誤ReferenceError:" userId "未定義。同時執行相同的操作。有沒有辦法訪問這個變量?