Skip to content

nathanmarks/google-places-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Places API Client

Detailed docs and tests coming soon...

Basic Usage

Current version only supports the autocomplete, searchtext and details endpoints.

import Places from 'google-places-js';

// Setup with server api key

const places = Places.create({ key: 'YOUR_API_KEY' });

// Logs the response from an autocomplete search

places.autocomplete('Toron');.then((res) => {
  console.log(res);
}).catch((err) => {
  console.log(err);
});

// Pass optional params as an object for all methods

places.autocomplete('Toron', {
  types: 'geocode'
});

// Logs the response from a text search

places.searchText('123 Queen St Toronto').then((res) => {
  console.log(res);
}).catch((err) => {
  console.log(err);
});

// Logs the response from a details request

places.details('SOME_PLACE_ID').then((res) => {
  console.log(res);
}).catch((err) => {
  console.log(err);
});

About

Simple API client for Google Places.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published