This NPM Module is the simplest interface for asynchronously querying the Google Directions API (https://developers.google.com/maps/documentation/directions/intro) via Node. Find more information about the API here: https://developers.google.com/maps/documentation/directions/intro.
npm i google_directions
Get a Google API Key
Include this. Here are the parameter details.
var map = ;var params =// REQUIREDorigin: ""destination: ""key: ""// OPTIONALmode: ""avoid: ""language: ""units: ""region: "";
There are six main methods to choose from.
Raw Google Direction API Response (JSON):
// get the raw Google Directions API response as JSON objectmap;
Navigation Steps (JSON):
// get navigation steps as JSON objectmap;
Total Distance (String):
// get total distance as stringmap;
Total Duration (String):
// get total duration as stringmap;
Starting Address (String):
// get the starting address as stringmap;
Destination Address (String):
// get the destination address as stringmap;
Still currently maintained and updated.