I am learning how to use the Mapbox API for my node app and I want to perform calculations on the backend like getting the distance between two coordinates.
How can I achieve this?, the Mapbox documentation doesn't make this clear...
Set-up the SDK
const mapboxSdk = require("mapbox")
let mapbox = new mapboxSdk(process.env.MAPBOX_TOKEN)
// EXAMPLE OF WHAT I WANT TO DO
coordA = {lat : 33.968123, long: -118.419454}
coordB = {{lat : 33.997223, long: -117.929145}}
const distance = await mapbox.getDistance(coordA, coordB)
console.log(distance)