JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 637
  • Score
    100M100P100Q90206F

Node.js library for the Google Places API

Package Exports

  • googleplaces

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (googleplaces) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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