This project contains a Node Express Boilerplate. with some dependencies
The main focus of this home-project is to create an endpoint with the following characteristics:
Implement the following route.
POST /calculation/metric/top-2-boxes
The calculation of the result MUST be a Top 2 Boxes statistic calculation.
Required request body payload of the endpoint MUST follow the following structure. I.e.
[
{
"participantId" : 2166342,
"optionId" : 47081,
"label" : "Definitivamente SÍ es para mí"
},
{
"participantId" : 2166355,
"optionId" : 47081,
"label" : "Definitivamente SÍ es para mí"
}
]Required response structure
The response of the endpoint MUST follow the following structure. I.e.
{
"calculation": "top2boxes",
"sampleSize": 300,
"totalParticipants": 300,
"score": 0.7034,
"histogram": [
{
"optionId": 47081,
"label": "Definitivamente SÍ es para mí",
"order": 1,
"frequencyCount": 53,
"frequencyPercentage": 0.1766,
"sampleSize": 300
},
{
"optionId": 47081,
"label": "Probablemente SÍ es para mí",
"order": 2,
"frequencyCount": 30,
"frequencyPercentage": 0.10,
"sampleSize": 300
}
]
}- Please fork this project repository in a personal repository.
- Implement the required endpoint and enjoy. Please limit yourself to a timebox of 4hrs of work.
- Notify us the result. If the repository is private please invite us to check the solution.
- We will rate, the code quality & structure, the requirements, and the calculations results.
- Perform an
npm install - To run the project just do a
node index.js