Neutrinos Peludos Magnéticos
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    closest-ec2-regionpublic

    Dependencies

    • libgeoip
    brew install libgeoip

    JS Example

    closestEC2Region = require("closest-ec2-region")();
     
    var ip = "xxx.xxx.xx.xx";
     
    closestEC2Region(ip, function(err, regionName) {
        
    });

    Express Example

     
    var express = require("express"),
    closestEC2Region = require("closest-ec2-region")();
     
    var server = express();
     
    server.get("/ec2/region", function(req, res) {
      closestEC2Region(req, function(err, region) {
        res.end(region);
      });
    });
     

    Custom Geo data

    closestEC2Region = require("closest-ec2-region")({
      cityDataPath: "/path/to/city/data"
    });
     
    var ip = "xxx.xxx.xx.xx";
     
    closestEC2Region(ip, function(err, regionName) {
        
    });

    With node-ectwo

     
    closestEC2Region(ip, function(err, regionName) {
      ectwo.regions.findOne({ name: regionName || "us-east-1" }, function(err, region) {
        //do stuff with the target region
      });
    });

    Keywords

    none

    install

    npm i closest-ec2-region

    Downloadsweekly downloads

    1

    version

    0.0.1

    license

    BSD

    repository

    githubgithub

    last publish

    collaborators

    • avatar
    • avatar