google-places-js

0.1.1 • Public • Published

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);
});
 

/google-places-js/

    Package Sidebar

    Install

    npm i google-places-js

    Weekly Downloads

    3

    Version

    0.1.1

    License

    none

    Last publish

    Collaborators

    • nmarks