Skip to content

Latest commit

 

History

History
138 lines (107 loc) · 3.08 KB

backend.md

File metadata and controls

138 lines (107 loc) · 3.08 KB

Software Engineer Challenge (Backend)

Build an API to calculate shortest driving path and estimated driving time to visit all specified locations, starting from the first in the list.
Note that we expect shortest driving distance (and estimated travel time), so you may want to use Google Maps API

Preferred languages (you are not required to pick from them):

  • PHP
  • Node.js
  • Golang

Solution requirements:

  • Source code must be stored in git repository (you can send it as github or bitbucket link, dropbox/google drive public folder, etc. NOTE: email servers will reject .zip files with source code)
  • For public repos:
    • Avoid words lalamove and challenge
    • Do not copy-paste any part of this file (task, API documentation, etc.)
    • This is needed to prevent other candidates from finding your solution
  • Blackbox. Must build/run in Docker container(s). docker-compose.yml must be provided
  • Must be asynchronous (a user must not wait for a driving route calculation during calls, see API below for details)
    • if PHP is used this requirement can be omitted, but the interface should be preserved.
  • Must be horizontally scalable
  • There is no specific requirements regarding documentation, architecture, etc. but we expect your solution to be production ready

Task:

Implement the following HTTP endpoints:

Submit start point and drop-off locations

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" }

or

{ "error": "ERROR_DESCRIPTION" }

Input body example:

[
	["22.372081", "114.107877"],
	["22.284419", "114.159510"],
	["22.326442", "114.167811"]
]

Response example:

{ "token": "9d3503e0-7236-4e47-a62f-8b01b5646c16" }

Get shortest driving route

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"
}

URL example:

  • /route/9d3503e0-7236-4e47-a62f-8b01b5646c16

Response example:

{
	"status": "success",
	"path": [
		["22.372081", "114.107877"],
		["22.326442", "114.167811"],
		["22.284419", "114.159510"]
	],
	"total_distance": 20000,
	"total_time": 1800
}

Questions? We love to answer: techchallenge@lalamove.com