This is the test solution for a coding challenge presented by Nova Futur to use React, NestJS and MaterialUI to build a full-stack app.
Client: React, MaterialUI
Server: NodeJS, NestJS
Tests: Jest
Storage: Memory
- Uses NestJS for microservices
- Uses OpenApi to document controller endpoints
- Uses Jest to test services in microservices
- Uses React as it's Front-End JS framework
- Uses Memory as storage
Clone the project
git clone https://github.com/dyllanhope/Advert-Statistics-Dyllan-hope.git
Go to the project directory
cd stats-backend
Install dependencies
yarn install
Start the server
yarn start
Go to the project directory
cd stats-manager
Install dependencies
yarn install
Start the server
yarn start
Once the server and manager service are up and running you can go to your localhost on port 3000 to view the Swagger
http://localhost:3000/api
Go to the project directory
cd stats-client
Install dependencies
yarn install
Start the client, it will open a browser tab to the client for you.
yarn start
retrieves all statistics saved in memory.
GET /statistics
Returns all statistics saved between the start and end dates.
GET /statistics/{startDate}/{endDate}
Parameter | Type | Description |
---|---|---|
startDate |
string |
Required. Date to start the date range with |
endDate |
string |
Required. Date to end the date range with |
Saves the following data model into memory.
POST /statistics
key | Type | Description |
---|---|---|
date |
string |
Required. Date statistics are saved for |
views |
number |
Number of views an advert has recieved |
clicks |
number |
Number of clicks this ad has recieved |
cost |
number |
The total cost of the ad |
Clears all statistics saved in memory.
POST /statistics/clear
Go to the project directory
cd stats-manager
then run test
yarn test
- A better, cleaner display component for the statistics.
- End-to-End testing of the Server as it is currently limited to the services.
- Event triggered loading icons, not required as the payloads are so small, however may take longer with:
- Bigger payloads.
- More in-depth statistics.
- Reaching a more remote endpoint.
- Add a DB or ORM for larger scale environments.
If you have any questions regarding my test solution please feel free to contact me via email: dyllanjhope@gmail.com