• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

Trying to write the JS code to calculate distance between 2 address

Can you please modify and let me know what code I have to put to calculate distance between 2 address using "Code" I have written the following code but it is giving and error :You cannot import node modules or use eval() in your code. We have already imported Node modules like 'crypto-js', 'lodash', and 'moment' into the wrapper function for you. To use them call these predefined variables: CryptoJS, _, moment respectively.

Is it possible to provide this some how if you don't like me putting this code

const AWS = require('aws-sdk');
const https = require('https');

const address1 = "New York City, NY";
const address2 = "Los Angeles, CA"; const url = `https://maps.googleapis.com/maps/api/distancematrix/json?origins=${address1}&destinations=${address2}&key=YOUR_API_KEY`;
https.get(url, (res) => {
res.on('data', (data) => {
const response = JSON.parse(data);
const distance = response.rows[0].elements[0].distance.text;
console.log(`The distance between ${address1} and ${address2} is ${distance}.`);
});
});

Note: I have put my google API but it's still not working
 
Top