0
searchJSON = {
location: 'NYC',
text: text,
authID: apiKey
};
searchRequest = {
host: siteUrl,
port: 80,
path: '/search',
method: 'GET'
};
searchResponse = makeRequest(searchRequest, searchJSON);
makeRequest = function(options, data) {
var req;
if (typeof data !== 'string') {
data = JSON.stringify(data);
}
req = http.get(options, function(res) {
var body;
body = '';
res.on('data', function(chunk) {
body += chunk;
});
return res.on('end', function() {
console.log(body);
});
});
console.log(data);
req.write(data);
req.end();
};
http://www.somesite.com/search?location=NYC&text=text&authID=[mykey]
으로 변환하지 않아야합니까?ExpressJS가 요청 명령을 제대로 실행하지 않는 이유는 무엇입니까?
를 작동 기본 요청 방법이다. –