DeividasJackus / nordsense-code-challenge

Code challenge for Nordsense

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code challenge for Nordsense

Original challenge document can be found here.

Authored 2019-06-06 by Deividas Jackus.

Requirements

  • node version 10.0.0 or later.
  • npm version 6.0.0 or later.

Installation

npm i

Usage

Once run, the server will start on port 3000 unless specified otherwise using the environment variable PORT.

Running in development mode

Auto-reload is enabled by default using Nodemon.

npm run dev

Running in development with debugging enabled

Debugging is achieved using debug.

DEBUG=app npm run dev

Running in production

NODE_ENV=production npm start

API

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
 }

About

Code challenge for Nordsense


Languages

Language:JavaScript 100.0%