The list of events events.csv is at the root of repository
npm start
Will open the port 3000 or set the env variable API_PORT
to the port you want (eg 8080
)
No tests was asked on subject, but I had time to code it
npm test
use the Jest framework (very simple, used before, automatic async + expect lib)
Nothing special needed: docker build .
I chose to use csv-parse
module (very famous, good coverage, good maintability and used before)
Express server with express integrated json middleware
- Prepare result object
- For loop to all points from API body
- For loop to all events
- Calculate nearest point
- Increment clicks or impressions for nearest point depend of
event_type
- For loop to all events
- Send results