A Node.js API to calculate a company NPS (Net Promoter Score).
The nps-calculator is an API where you can register user, survey, send email to users answer the surveys and then the API calculates the NPS.
Prerequisites:
Download and install Node.js and Yarn.
- First, clone the repository:
git clone https://github.com/erickmp07/nps-calculator.git
- Install its dependencies with
yarn
command:
cd nps-calculator
yarn
Prerequisites:
Download and install Docker.
- First, pull the image with the command:
docker pull erickmp07/nps-calculator:latest
Start the server:
yarn dev
Note: To run the tests:
yarn test
The application can be accessed at localhost:3333
.
Run the image with the command:
docker run -p 49160:3333 -d erickmp07/nps-calculator
The application can be accessed at localhost:49160
.
This project was developed with the following technologies:
The available routes are:
# POST (JSON) - Create User
http://localhost:{port}/users
body: {
"name": "username",
"email": "email@domain.com"
}
# POST (JSON) - Create Survey
http://localhost:{port}/surveys
body: {
"title": "title",
"description": "description"
}
# GET - Show Surveys
http://localhost:{port}/surveys
# POST (JSON) - Send Mail
http://localhost:{port}/sendMail
body: {
"email": "user_email",
"survey_id": "survey_id"
}
# GET - Answer Survey
http://localhost:{port}/answers/:value
# GET - Calculate NPS
http://localhost:{port}/nps/:survey_id
PRs and stars are always welcome.
To ask a question, please contact me.
Licensed under MIT license.