This project was bootstrapped with Create React App.

Libraries

In this project, I've used react, and experimented a little with recently released react-hooks for building this app.

Helper libraries were used as under -

Setup

A set of data from is placed in the project as a file named as events.json This data is also used to test the application.

Pre-requisites

  • node
  • npm
  • GNU make (if running using makefile)

Scripts

1. Makefile

In the project directory, you can run:

make

There's a Makefile included in this project at the top of the repository. The Makefile is very simple and has a default target to install the npm dependencies and start the server in development mode.

There are additional targets as under which are self-explanatory. make help , make clean, make install, make production and make run.

2. npm scripts

The project can also be run using the package.json scripts. In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
You will also see any lint errors in the console if running in the development mode.

The server is running at http://localhost:8080
Open the server http://localhost:8080/api to view the data.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

The static files under build folder can be served using server.js.

Testing

Tests are written for the alerting login using the unit test libraries Mocha and chai. The test implementation can be found under './tests/project/service/monitoring.service.test.js'

To run the tests execute the command below,

npm test-server

Improvements

  • Created push notification on alert generated.
  • Create Socket API to constantly push the stream of events when data is available.
  • Write the tests for client application.