Error: GoogleMapsAPI is not defined for node -googlemaps

I am using node-googlemaps to query Google Maps APIfrom Node js. I created my server API as a developer. According to this documentation, I have to make a variable publicConfigwith my API key and some other parameters. My publicConfig variable is as follows:

 var gm = require('googlemaps');
 var publicConfig = {
  key: 'myKey',
  stagger_time:1000, // for elevationPath
  encode_polylines:false,
  secure:true // use https
};
 var gmAPI = new GoogleMapsAPI(publicConfig);

When I run the code, I get the following error

 ReferenceError: GoogleMapsAPI is not defined

Can someone help me on this?

+4
source share
1 answer

To solve this problem, I included the following line of code

var GoogleMapsAPI = require('googlemaps');
+10
source

Source: https://habr.com/ru/post/1609176/


All Articles