Skip to content

Instantly share code, notes, and snippets.

@jcreedcmu
Created October 6, 2019 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcreedcmu/0842b7a550b8758c48fa9397e6e86cb8 to your computer and use it in GitHub Desktop.
Save jcreedcmu/0842b7a550b8758c48fa9397e6e86cb8 to your computer and use it in GitHub Desktop.
const fs = require('fs');
const qs = require('querystring');
const https = require('https');
const query = {
key: fs.readFileSync('/home/jcreed/private/maps-api2', 'utf8').replace(/\n/g, ''),
input: "chipotle",
inputtype: "textquery",
fields: "formatted_address,name",
location: "40.7831,-73.9712", // manhattan
radius: 10000
};
const url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?" + qs.encode(query);
console.error(url);
https.get(url, (response) => {
let body = '';
response.on('data', (chunk) => {
body += chunk;
});
response.on('end', () => {
console.log(body);
});
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment