小编Axe*_*era的帖子

如何使用Async Await使用Google Maps Node API

The following is example taken from the Google Maps node module

function doSomeGeoCode() {

  const googleMapsClient = require('@google/maps').createClient({
    key: 'your API key here',
    Promise: Promise
  });

  googleMapsClient.geocode({address: '1600 Amphitheatre Parkway, Mountain 
   View, CA'})
  .asPromise()
  .then((response) => {
    console.log(response.json.results);
  })
  .catch((err) => {
    console.log(err);
  });
}
Run Code Online (Sandbox Code Playgroud)

如何使用async和await调用doSomeGeoCode。同样,一旦收到响应,我就需要调用另一个函数。请建议

google-maps-api-3 node.js async-await

2
推荐指数
1
解决办法
1176
查看次数

标签 统计

async-await ×1

google-maps-api-3 ×1

node.js ×1