我创建了以下函数,用于检查简单数据库域中是否存在值。
当我独立调用它时,我得到了正确的结果,但如果我将其称为http服务器代码的一部分,我将收到InvalidParameterType错误。
var server = http.createServer(function(requester, response) {
var parsedUrl = url_mod.parse(requester.url.toLowerCase());
if (parsedUrl.pathname == "/") {
response.writeHead(200, {
"Content-Type": "text/plain"
});
response.end("Unicorn11 was here\n");
} else if (parsedUrl.pathname == "/clientlist/") {
response.writeHead(200, {
"Content-Type": "text/plain"
});
response.end("user does not exist\n");
checkExists();
} else {
response.writeHead(404, {
"Content-Type": "text/plain"
});
response.end("42! :) \n");
}
});
server.listen(8000);
console.log("Server running at port 8000");
function checkExists() {
console.log("checkExists");
simpledb.select(params = {
'SelectExpression': 'select * from xxx where x = "y"'
}, checkExistsCallback);
};
function checkExistsCallback(err, data) {
console.log(JSON.stringify(data));
console.log(JSON.stringify(err));
//return false;
};
知道为什么会这样吗? 问候 阿布舍克巴克