https://github.com/jcblw/geode
:earth_americas: wrapper for www.geonames.org written in javascript as a node module
https://github.com/jcblw/geode
api geonames
Last synced: over 1 year ago
JSON representation
:earth_americas: wrapper for www.geonames.org written in javascript as a node module
- Host: GitHub
- URL: https://github.com/jcblw/geode
- Owner: jcblw
- Created: 2013-01-24T19:55:04.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2020-11-17T04:58:47.000Z (over 5 years ago)
- Last Synced: 2025-03-15T13:36:37.716Z (over 1 year ago)
- Topics: api, geonames
- Language: JavaScript
- Homepage:
- Size: 53.7 KB
- Stars: 58
- Watchers: 9
- Forks: 19
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Geode
[](https://greenkeeper.io/)
[](https://travis-ci.org/jcblw/geode)[](https://coveralls.io/github/jcblw/geode?branch=master)
Locations API in node from www.geonames.org
## Install
```shell
npm install geode
```
## Use
You will need an account ~ *its free* ([signup](http://www.geonames.org/login)).
```javascript
//include
var geo = new geode('username', {language: 'en', countryCode : 'US'})
geo.search({name :'Riverside'}, function(err, results){
console.log([err, results])
})
```
## Demo
Here is a simple Express App throwing up an API. (see [demo](http://geode-demo.herokuapp.com/search.json?q=riverside&maxRows=2)).
The express code is just
```javascript
var api = new Geode('username', {countryCode: "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
```