const axios = require('axios');
async function fetchRoute() {
const apiKey = 'YOUR_API_KEY_HERE';
const apiUrl = 'https://www.usepathway.dev/api/routing';
const payload = {
data: {
coordinates: [
[12.9715987, 77.5945627], // Example coordinate
[13.0826802, 80.2707184] // Example coordinate
]
}
};
try {
const response = await axios.post(apiUrl, payload, {
headers: { 'x-api-key': apiKey }
});
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
}
fetchRoute();