Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FelipePDS/nps

Repository files navigation

NPS

NPS API (Net Promoter Score)
Calculation of the NPS of a company, in which it is provided based on the evaluation of the users. The company can calculate the NPS for the diverses subjects it selects. Learn more




Topics

  • Project
    • About
      • Example of How it Works
    • Techs
      • Backend
      • For Dev
    • Use API
      • How to Clone
      • How to Configure
      • How to Run
  • Documentation (to learn about developing an API)
  • References (materials)
  • Author
  • License

Project

know the project, the technologies used for its construction and if you want to use the API, see how to use it.


About

The construction of this NPS API (Net Promoter Score) was to facilitate the evaluation process of a company for example. This questionnaire will be sent to the user's e-mail (which may have the text and style you want), where he will give his rating in relation to the subject and thus the NPS will be calculated based on the evaluation of all users.

The process is based on 3 things as a basis:
The survey, the user, and the user evaluation,
Survey email for evaluation (Title and description) - User - User evaluation - Saved evaluation correlating the user, the survey and the evaluation - Total NPS calculation, see an example:

Example of How it Works


Techs

Backend

- Check the file: package.json

For Dev


Use API

Before we see how to use the API, let's understand a little bit about some things about it

See data modeling to understand a little about its structure:


How to Clone

To perform your cloning we need the Gitbash terminal, which we will do using commands that already automate some processes...

# To clone repository
$ git clone https://github.com/FelipePDS/nps.git

# Open
$ cd nps

How to Configure

Before all install the dependencies (technologies used):

$ yarn add
# OR
$ npm install

Run the Database:

# Execution made with Typeorm (run the migrations and the database)

$ yarn typeorm migration:run
# OR
$ npm run typeorm migration:run
If you want to change the server's execution port: Go to the .env file, change 3333 from both the PORT and USER_ANSWER_URL_MAIL to the port you want

How to Run

Before all execute the server:

$ yarn dev
# OR
$ npm dev

# If you have not changed the port, the access URL will be http://localhost:3333/

To perform the execution tests (API Rest) install the Insomnia. Thus it will be possible to send requests for routes...

Take a look at the router.ts file to check the routes and make requests

See what are the parameters needed to make each type of request (and the routes)

  • User
  • Survey
  • Send Mail
  • NPS Calculate

User

/* baseURL/users (POST Method) */
{
"name": "User Example",
"email": "example@mail.com"
}

Survey

/* baseURL/surveys (POST Method) */
{
"title": "Give your evaluation:",
"description": "From 0 to 10, how much would you recommend Rocketseat?"
}

Send Mail

/* baseURL/sendMail (POST Method) */
{
"email": "example@mail.com",
"survey_id": "idOfSomeSearchSavedInTheSystem"
}

NPS Calculate

baseURL/nps/:survey_id (GET Method)


See better how it works

Documentation (to learn about developing an API)

Documentation about the development. To download the documentation follow the commands in Gitbash

> .git/nps/sparse-checkout # pull the subdirectory $ git pull origin master"># create a folder with the name of the directorie and enter it
$ mkdir documentation && cd documentation

# start a git repository to access the repository
$ git init

# crawl the repositorie
$ git remote add -f origin https://github.com/FelipePDS/nps

# active sparse checkout
$ git config core.sparseCheckout true

# Create a file in the path: .git/nps/sparse-checkout
# And insert the name of the subdirectory you want to clone
$ echo '.github/documentation/' >> .git/nps/sparse-checkout

# pull the subdirectory
$ git pull origin master
Font: terminalroot.com.br

References (materials)

The entire project was developed during the RocketSeat NLW event, and was aided through documentation as well...


Author

This repository and documentation was made by FelipePDS


License

MIT License * (c) FelipePDS

About

will an api there? Calculation NPS (evaluations of something) of a registered user

Topics

Resources

Readme

License

MIT license

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors