There is a webpage http://ip2c.org/ and it parses any ip number to a country name, all I have to do is to give it an argument such as http://ip2c.org/10.0.1.3
(I know it's my local host, it's just for tests). When I run it in the browser, I'm seeing 1;ZZ;ZZZ;Reserved
which is fine, I understand it's not an Ip address that can be reversed-geo tagged. But I expected to have a similar result in my node.js/angular app.
So far I created in my backend code a function:
app.get('/get/ip/address', function (req, res) {
var ip = require('ip');
res.json(ip.address());
})
and in my front end query controller:
$scope.countryName = function() {
$http.get('/get/ip/address').success(function (data) {
console.log(data);
console.log("!!!!!");
$http.get('http://ip2c.org/'+data).success(function (data) {
console.log(data);
})
})
}
When I run it, I see:
queryCtrl.js:127 10.0.1.3 queryCtrl.js:128 !!!!! webpage.html:1 XMLHttpRequest cannot load http://ip2c.org/10.0.1.3. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access
How can I obey it and see the correct result in my console?