Net Promoter Score
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:
- Node.js
- Express
- TypeORM
- Sqlite3
- Metadata Reflection API
- uuid
- Handlebars
- Nodemailer
- Yup
- ExpressJS Async Errors
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.