Skip to content
/ nps Public

API for NPS of the Next Level Week 4.0 πŸš€

License

Notifications You must be signed in to change notification settings

BiaChacon/nps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

About β€’ Features β€’ How it works β€’ Tech Stack β€’ Documentation β€’ Authors β€’ License

ℹ️ About

API Restful for Net Promoter Score created at RocketSeat Next Level Week 4.0, using stack TypeScript with Node.js.


βš™οΈ Features

  • Create User
  • Create Survey
  • View list surveys
  • Send Mail
  • Calculate NPS

πŸ›  Tech Stack

The following tools were used in the construction of the project:

Tools used for testing:


πŸš€ How it works

πŸ‘‰ Pre-requisites

Before you begin, you will need to have the following tools installed on your machine: Git, Node.js and Yarn. In addition, it is good to have an editor to work with the code like VSCode.

🏁 Start

# Clone this repository
$ git clone https://github.com/BiaChacon/nps.git

# Access the project folder cmd/terminal
$ cd nps

🎲 Running the server

# go to the api folder
$ cd api

# install the dependencies
$ npm install

#Create migrations
$ yarn typeorm migration:run

# Run the application
$ yarn dev

# The server will start at port: 3333 - go to http://localhost:3333

# Running the tests
$ yarn test

πŸ—Ž Documentation

Surveys

Surveys [/surveys]

πŸ“ Create Survey [POST]

Request

  • Body
{
  "name": "Name User",
  "email": "example@email.com"
}

Response 201 (application/json)

[
  {
    "id": "f34635eb-a4c4-4698-94af-19bdd923a003",
    "title": "Queremos ouvir sua opiniΓ£o!",
    "description": "De 0 a 10, quanto vocΓͺ recomendaria a Empresa?",
    "created_at": "2021-02-26T13:35:34.000Z"
  }
]

πŸ“ List all Surveys [GET]

Response 200 (application/json)

{
  "id": "feecb0ce-c336-462c-a05e-ac9a0c9f1049",
  "title": "Queremos ouvir sua opiniΓ£o!",
  "description": "De 0 a 10, quanto vocΓͺ recomendaria a Empresa X?",
  "created_at": "2021-02-27T15:07:13.000Z"
}
Users

Users [/users]

πŸ“ Create User [POST]

Request

  • Body
{
  "name": "Name User",
  "email": "example@email.com"
}

Response 201 (application/json)

{
  "id": "413ecd5c-7932-41b1-b4d2-06c976303450",
  "name": "Name User",
  "email": "example@email.com",
  "created_at": "2021-02-27T15:06:33.000Z"
}
SendMail

SendMail [/sendMail]

πŸ“ Send [POST]

Request

  • Body
{
  "email": "example@email.com",
  "survey_id": "f34635eb-a4c4-4698-94af-19bdd923a003"
}

Response 200 (application/json)

{
  "id": "36408f2d-ee50-4456-a07b-101e695b794a",
  "user_id": "413ecd5c-7932-41b1-b4d2-06c976303450",
  "survey_id": "f34635eb-a4c4-4698-94af-19bdd923a003",
  "created_at": "2021-02-27T15:08:07.000Z"
}
NPS

NPS [/nps/:id_survey]

πŸ“ Calculate NPS

Response 200 (application/json)

{
  "detractor": 1,
  "promoters": 2,
  "passive": 0,
  "totalAnswers": 3,
  "nps": 33.33
}

πŸ‘©πŸ½β€πŸ’» Authors


Bia Chacon

πŸ’»

πŸ“ License

This project is under MIT. See at here LICENSE for more information.


README versions

English πŸ‡ΊπŸ‡Έ | Portuguese πŸ‡§πŸ‡·

About

API for NPS of the Next Level Week 4.0 πŸš€

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published