错误:没有为node-googlemaps定义GoogleMapsAPI

shu*_*l92 5 google-api google-maps-api-3 node.js npm sails.js

我正在使用node-googlemaps来查询Google Maps API来自Node js.我已经创建了我的Server API密钥作为开发人员.根据文档,我必须publicConfig使用我的API密钥和某些其他参数创建变量.我的publicConfig变量如下:

 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);
Run Code Online (Sandbox Code Playgroud)

当我运行代码时,我收到以下错误

 ReferenceError: GoogleMapsAPI is not defined
Run Code Online (Sandbox Code Playgroud)

有人可以帮我解决这个问题吗?

shu*_*l92 12

为了解决这个问题,我已经包含以下代码行

var GoogleMapsAPI = require('googlemaps');
Run Code Online (Sandbox Code Playgroud)