Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 1.65 KB

README.md

File metadata and controls

60 lines (40 loc) · 1.65 KB

Ad tracker

How to

The project requires a connection to MongoDB.

In prod environment it uses free instance of MongoDB Atlas cluster.

Run project

  1. Provide your MongoDB credentials
  2. issue npm i
  3. issue npm start
  4. visit http://localhost:3000/mock-ad/ad

Run tests

  1. Provide your MongoDB credentials
  2. issue npm i
  3. issue npm test

Example usage

Deployment

Application is deployed through Github Actions Pipeline to Heroku PaaS.

Please find the app under following link: https://ads-tracker-cldnry.herokuapp.com/

API

  • /event - allows tracking of ad events.

Accepts POST requests with following body:

{
  "ad": "string",
  "type": "string"
}

where type is either load or clicked

  • /reports/:date - allows generating daily events report Accepts GET requests with :date parameter in yyyy-MM-dd format

High Level Architecture

Level 0 diagram

Considerations:

  • c4 model chosen as an appropriate tool for architecture visualization
  • ad mocker integrated into the tracking api through a separate mocking router
  • date-fns for handling dates
  • assumed enGB locale
  • dateProvider as an injectable plain JS object to make testing and possible future operations on dates isolated