i am working on a project in NODE.JS in which when user logged in,his area's weather is automatically shown on his dashboard. According to my understanding,when a client comes:
1)His ip is traced for which m using request-ip.
2)Then according to this ip dimensions of his area can be determined.for this m using satelize.
3)Then on the basis of longitude and latitude,his area's weather can be predicted with the help of forcast.io.
problem is sending request to that middleware,m getting loopback ip.(localhost:3000).while i want to get any random client's ip.so that i can check whether my api is working correct or not. here is my code:
router.get('/',function(req,res){
var clientIp = requestIp.getClientIp(req); //inside middleware handle
satelize.satelize({ip:clientIp}, function(err, geoData) { // if data is JSON, we may wrap it in js object
var obj = JSON.parse(geoData);
forecast.get([obj.latitude, obj.longitude], function(err, weather) {
if(err) return console.dir(err);
console.log(weather);
});
});
});