Newton's Programmatic Measurements
Learn how companies like Phone2Action are using npm in their front-end developmentJoin the conversation »

geode

1.0.0 • Public • Published

Geode

locations api in node from www.geonames.org

Install

npm install geode

Use

you will need an account ~ its free

Signup
//include
var geo = new geode('username', {language: 'en', country : 'US'})
 
geo.search({name :'Riverside'}, function(err, results){
    console.log([err, results])
})

Demo

Heres a simple Express App throwing up an api

Demo

The express code is just

var api = new Geode('username', {country: "US", language: 'en'});
 
app.get('/:collection.:format', function(req, res){
  if(req.params.collection && req.params.format){
    api[req.params.collection](req.query, function(err, collection){
      res[req.params.format]({status : 200, results : collection});
    });
  }else{
    res.send('404');
  }
})

Testing

Make sure to install the development dependecies npm install --dev and then run.

USER=yourusername npm test

Keywords

none

Install

npm i geode

DownloadsWeekly Downloads

8

Version

1.0.0

License

none

Last publish

Collaborators

  • avatar