googleplaces

Node.js library for the Google Places API

npm install googleplaces
24 downloads in the last week
179 downloads in the last month

googleplaces.js

A node.js library for the Google Places API

ugh?

googleplaces.js makes it easy to talk to the Google Places API from your server side Node.js application

can i use in the browser?

Google already maintains a dedicated client side JavaScript library

what's supported?

what's coming soon?

can i contribute?

Yes, fork and hack away

get started

google

code

$ npm install googleplaces

config.js

exports.apiKey = "..your api key here..";
exports.outputFormat = "json";

place-search.js

var config = require("./config.js");

var GooglePlaces = require("googleplaces");
var googlePlaces = new GooglePlaces(config.apiKey, config.outputFormat);
var parameters;

/**
 * Place search - https://developers.google.com/places/documentation/#PlaceSearchRequests
 */
parameters = {
  location:[-33.8670522, 151.1957362],
  types:"doctor"
};
googlePlaces.placeSearch(parameters, function (response) {
  console.log(response.results);
});

text-search.js

var config = require("./config.js");

var GooglePlaces = require("googleplaces");
var googlePlaces = new GooglePlaces(config.apiKey, config.outputFormat);
var parameters;

/**
 * Text search - https://developers.google.com/places/documentation/#TextSearchRequests
 */
parameters = {
  query:"restaurants in dublin"
};
googlePlaces.textSearch(parameters, function (response) {
  console.log(response.results);
});

place-details-request.js

var config = require("./config.js");

var GooglePlaces = require("googleplaces");
var googlePlaces = new GooglePlaces(config.apiKey, config.outputFormat);
var parameters;

/**
 * Place details requests - https://developers.google.com/places/documentation/#PlaceDetails
 */
parameters = {
  location:[-33.8670522, 151.1957362],
  types:"doctor"
};
googlePlaces.placeSearch(parameters, function (response) {
  googlePlaces.placeDetailsRequest({reference:response.results[0].reference}, function (response) {
    console.log(response.result);
  });
});

examples repo

https://github.com/Srirangan/googleplaces.js-examples

npm loves you