Skip to content

Commit

Permalink
First
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Dec 4, 2013
0 parents commit cf009f8
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
@@ -0,0 +1,3 @@
# mapbox

A node.js interface to MapBox.
23 changes: 23 additions & 0 deletions index.js
@@ -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;
})();
26 changes: 26 additions & 0 deletions package.json
@@ -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"
}

0 comments on commit cf009f8

Please sign in to comment.