An API to calculate shortest driving path and estimated driving time to visit all specified locations, starting from the first in the list.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
docker and docker-compose
docker-compose up
If you visit http://127.0.0.1:3000 you should see "It is Working".
- Express Nodejs
- Redis
- POST
/route
: Submit start point and drop-off locations - GET
/route/<TOKEN>
: Get shortest driving route
Method:
POST
URL path:
/route
Input body:
[
["ROUTE_START_LATITUDE", "ROUTE_START_LONGITUDE"],
["DROPOFF_LATITUDE_#1", "DROPOFF_LONGITUDE_#1"],
...
]
Response body:
HTTP code 200
{ "token": "TOKEN" }
Input body example:
[
["22.372081", "114.107877"],
["22.284419", "114.159510"],
["22.326442", "114.167811"]
]
Response example:
{ "token": "r1YiiTpoW" }
Get shortest driving route for submitted locations (sequence of [lat, lon]
values starting from start location resulting in shortest path)
Method:
GET
URL path:
/route/<TOKEN>
Response body:
- HTTP 200
{
"status": "success",
"path": [
["ROUTE_START_LATITUDE", "ROUTE_START_LONGITUDE"],
["DROPOFF_LATITUDE_#1", "DROPOFF_LONGITUDE_#1"],
...
],
"total_distance": DRIVING_DISTANCE_IN_METERS,
"total_time": ESTIMATED_DRIVING_TIME_IN_SECONDS
}
or
{
"status": "in progress"
}
or
{
"status": "failure",
"error": "ERROR_DESCRIPTION",
"googleError": "ZERO_RESULTS"
}
URL example:
/route/r1YiiTpoW
Response example:
{
"status": "success",
"path": [
["22.372081", "114.107877"],
["22.326442", "114.167811"],
["22.284419", "114.159510"]
],
"total_distance": 18143,
"total_time": 1778
}