Skip to content
Web Service for Getting Lat/Lng based on Country and Postal Code
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
resources
routes
.gitignore
README.textile
app.js
package.json

README.textile

Pwny Express

Web service to get lat/lng based on ISO country and postal code.
You know…because it has to do with postal codes and it’s written in Express.

Installing

  1. Clone repository
  2. npm install
  3. unzip ./resources/allCountries.txt.zip to ./resources/allCountries.txt
  4. npm start

Using

http://localhost:3000/postal_codes/[2LETTER-ISO-COUNTRY-UPCASE]/[POSTAL CODE]

e.g http://localhost:3000/postal_codes/US/33351

Performance / Scalability

Running This as an Express App

This proof-of-concept performs remarkably un-shittyful for being a data structure fed by a 69MB text file.
Like, freaky fast. If you’re going to want to add any conditional logic or intellegence then you’re going
to obviously want to use Express. Maybe you’ll want to customize the data store.

If you put this behind Varnish there’d be no stopping you.
You would crush your enemies, see them driven before you, and hear the lamentation of their women.

Exporting Static Files

If all you need is lat lng…it seems easy enough to write a script that would generate static files
in a directory structure that would look like the endpoints. I could imagine serving static files with nginx being
the fastest, most stable, and least-engineered way of running your own lat/lng service.

Data

This data is from Geonames Postal Code Database
Master HEAD currently uses the verison created 2017-07-23 09:48
Send me a PR is it gets out of date.

You can’t perform that action at this time.