Я установил https://github.com/googlemaps/google-maps-services-js
подключаю import maps from '@google/maps';
Я создаю клиента:
const googleMapsClient = maps.createClient({
key: 'api key',
});
Я хочу получить широту и долготу:
router.post('/add', (req, res) => {
googleMapsClient.geocode({
address: '1600 Amphitheatre Parkway, Mountain View, CA'
}, (err, res) => {
if (!err) {
console.log(res.json.results);
return res.status(500).json({
message: res.json.results
});
}
console.log(err);
return res.status(500).json({
err: err
});
});
...
Моя проблема в том, что он впервые дал информацию
[ { address_components:
[ [Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object] ],
formatted_address: '1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA',
geometry:
{ location: [Object],
location_type: 'ROOFTOP',
viewport: [Object] },
place_id: 'ChIJhhRjJ-5j4ARKFsUSrwhY',
plus_code:
{ compound_code: 'CWC8+JH Mountain View, California, United States',
global_code: '849VCWC8+JH' },
types: [ 'street_address' ] } ]
Все в следующий раз, когда он дает мне
timeout
Как я могу решить эту проблему?