Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cf009f8
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# mapbox | ||
|
||
A node.js interface to MapBox. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var request = require('request'); | ||
|
||
module.exports = (function() { | ||
var api_key = null; | ||
|
||
var mapbox = {}; | ||
|
||
mapbox.apiKey = function(_) { | ||
if (!arguments.length) return api_key; | ||
api_key = _; | ||
return mapbox; | ||
}; | ||
|
||
mapbox.geocode = function(_, cb) { | ||
if (!api_key) return cb(new Error('API Key Required')); | ||
request({ | ||
url: 'http://api.tiles.mapbox.com/v3/' + api_key + '/geocode/' + encodeURIComponent(_) + '.json', | ||
json: true | ||
}, cb); | ||
}; | ||
|
||
return mapbox; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "mapbox", | ||
"version": "0.0.0", | ||
"description": "an api for mapbox", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "mocha -R spec" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mapbox/node-mapbox.git" | ||
}, | ||
"keywords": [ | ||
"mapbox", | ||
"api", | ||
"rest", | ||
"maps", | ||
"geocoding" | ||
], | ||
"author": "", | ||
"license": "BSD-2-Clause", | ||
"bugs": { | ||
"url": "https://github.com/mapbox/node-mapbox/issues" | ||
}, | ||
"homepage": "https://github.com/mapbox/node-mapbox" | ||
} |