Skip to content

A Node.js API to calculate a company NPS (Net Promoter Score).

License

Notifications You must be signed in to change notification settings

erickmp07/nps-calculator

Repository files navigation

nps-calculator

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.

Table of Contents

Install

Locally

Prerequisites:

Download and install Node.js and Yarn.

  • First, clone the repository:
git clone https://github.com/erickmp07/nps-calculator.git
cd nps-calculator
yarn

Docker container

Prerequisites:

Download and install Docker.

  • First, pull the image with the command:
docker pull erickmp07/nps-calculator:latest

Usage

Locally

Start the server:

yarn dev

Note: To run the tests:

yarn test

The application can be accessed at localhost:3333.

Docker container

Run the image with the command:

docker run -p 49160:3333 -d erickmp07/nps-calculator

The application can be accessed at localhost:49160.

Technologies

This project was developed with the following technologies:

API

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

Contributing

PRs and stars are always welcome.

To ask a question, please contact me.

License

Licensed under MIT license.