Original challenge document can be found here.
Authored 2019-06-06 by Deividas Jackus.
node
version 10.0.0 or later.npm
version 6.0.0 or later.
npm i
Once run, the server will start on port 3000 unless specified otherwise using the environment variable PORT
.
Auto-reload is enabled by default using Nodemon.
npm run dev
Debugging is achieved using debug.
DEBUG=app npm run dev
NODE_ENV=production npm start
The API exposed is a single endpoint.
Unless specified otherwise, all handlers return a HTTP status code of 2xx upon success and a 4xx error upon user input error.
Finds the intersection closest to the point provided along with angle & cardinal direction of the point in relation to the intersection.
Intersection data is loaded from intersections.csv
(extracted from sheet originally provided as part of the challenge).
Response format:
{
point: { // Input point
latitude,
longitude,
},
nearestIntersection: {
id, // GISObjectID of the intersection
name, // Name of the intersection
latitude,
longitude,
},
distance, // Distance in kilometers between the provided point & the intersection
bearing, // Angle of the provided point in relation to the intersection
direction, // Cardinal direction of the provided point in relation to the intersection
}