As shown in the image We have a start and end point forming a route I need to get all the points(Lat,Lng) forming this route.
This is how I implemented the directions:
var directions = L.mapbox.directions();
var directionsLayer = L.mapbox.directions.layer(directions)
.addTo(map);
var directionsInputControl = L.mapbox.directions.inputControl('inputs', directions)
.addTo(map);
var directionsErrorsControl = L.mapbox.directions.errorsControl('errors', directions)
.addTo(map);
var directionsRoutesControl = L.mapbox.directions.routesControl('routes', directions)
.addTo(map);