Skip to content
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.
/ geocode_service Public archive

Provides a minimalistic web service to map IPs to countries

License

Notifications You must be signed in to change notification settings

mtarnovan/geocode_service

Repository files navigation

Geocode Service

Provides a minimalistic web service to map IPs to countries from a local MySQL database generated from data available from maxmind.com. Uses Sinatra and MySQL. Inspired by this article: http://jcole.us/blog/archives/2007/11/24/on-efficiently-geo-referencing-ips-with-maxmind-geoip-and-mysql-gis/

Usage:

gem i bundler
bundle install
[edit db/database.yml and create the database geocode_service]
rake load_data
[for production, set RACK_ENV accordingly:]
RACK_ENV=production rake load_data
rackup

Test it:

curl http://localhost:9292/country_code_from_ip/[some ip here]

Empty body and 404 response status means IP was not found in the database.

Why ?

  • fast
  • avoids external dependencies, but reusable across multiple apps

TODO

  • add authentication ?

About

Provides a minimalistic web service to map IPs to countries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages