Skip to content

Instantly share code, notes, and snippets.

@funkyboy
Created December 29, 2014 17:41
Show Gist options
  • Select an option

  • Save funkyboy/ecc754dbe0f89e4a4c56 to your computer and use it in GitHub Desktop.

Select an option

Save funkyboy/ecc754dbe0f89e4a4c56 to your computer and use it in GitHub Desktop.
// GET /plugin/geo.bb?ip=xx.yy.zz.kk
var endpoint="http://www.geoplugin.net/json.gp?ip=";
http().get(function(req){
var ip=req.queryString.ip
if (!ip) return {status:400,content:"Missing ip parameter"};
ip=ip[0];
Box.log(endpoint+ip);
var result=Box.WS.get(endpoint,{params:{ip:ip}});
Box.log(result);
return {status: 200,content:JSON.parse(result.body)};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment