I train myslef using NodeJS and have tried a simple GET call. Here is my code:
var http = require('http');
var options = {
host: 'www.boardgamegeek.com',
path: '/xmlapi/boardgame/1?stats=1',
method: 'GET'
}
var request = http.request(options, function (response) {
var str = ""
response.on('data', function (data) {
str += data;
});
response.on('end', function () {
console.log(str);
});
});
request.on('error', function (e) {
console.log('Problem with request: ' + e.message);
});
request.end();
The url seems to work in my browser https://www.boardgamegeek.com/xmlapi/boardgame/1?stats=1
In any case, I have a problem with the request: connect ETIMEDOUT when running the code, and I have no idea how to fix it.
What can cause this error? Is this my code or network / proxy problem?
source
share