https://github.com/tavareshenrique/nps-api-nlw
NPS é uma API criada utilizando NodeJS e TypeScript durante a NLW#4 da Rocketseat.
https://github.com/tavareshenrique/nps-api-nlw
nlw nlw-4 nodejs nps-api rocketseat rocketseat-nlw typescript
Last synced: 26 days ago
JSON representation
NPS é uma API criada utilizando NodeJS e TypeScript durante a NLW#4 da Rocketseat.
- Host: GitHub
- URL: https://github.com/tavareshenrique/nps-api-nlw
- Owner: tavareshenrique
- License: mit
- Created: 2021-02-23T04:04:06.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-28T21:32:55.000Z (over 5 years ago)
- Last Synced: 2025-01-10T20:18:07.605Z (over 1 year ago)
- Topics: nlw, nlw-4, nodejs, nps-api, rocketseat, rocketseat-nlw, typescript
- Language: TypeScript
- Homepage:
- Size: 184 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> NPS API é uma API criada utilizando NodeJS com Express e TypeScript durante a NLW#4 da [Rocketseat](https://github.com/Rocketseat). Esse projeto permite o calculo de NPS de uma empresa enviado por usuários via email.
# :pushpin: Conteúdo
- [API](#floppy_disk-api)
- [NPS](#nps)
- [Calculate](#calculate)
- [Mail](#mail)
- [Send Mail](#send-mail)
- [Survey](#survey)
- [Create Survey](#create-survey)
- [List All Surveys](#list-all-survey)
- [Users](#user)
- [Create User](#create-user)
- [Tecnologias](#computer-tecnologias)
- [Executando](#construction_worker-executando)
- [Autores](#computer-autores)
- [Licença](#closed_book-licença)
# :floppy_disk: API
# NPS
## Calculate
Esse End-Point para calcular o NPS.
- **URL**
`/nps/:surveyId`
- **Method:**
`GET`
- **URL Params**
- **Required:**
`:surveyId` **-> ID do survey.**
- **Success Response:**
- **Code:** 200
**Content:**
```json
{
"detractor": 1,
"pasive": 0,
"promoters": 2,
"totalAnswers": 3,
"nps": 33.33
}
```
---
# Mail
## Send Mail
Enviar email.
- **URL**
`/sendMail`
- **Method:**
`POST`
- **JSON Example:**
```json
{
"email": "henrique@email.com",
"survey_id": "eeb3d144-df68-4f5c-8ae2-5d498a2db412"
}
```
- **Success Response:**
- **Code:** 200
**Content:**
```json
{
"id": "13e43459-f251-499c-a5b5-1f18c5aac461",
"user_id": "ada144d3-2164-40e6-b410-cb6f6f87c98d",
"survey_id": "eeb3d144-df68-4f5c-8ae2-5d498a2db412",
"created_at": "2021-02-28T00:36:15.000Z"
}
```
---
# Survey
## Create Survey
Criando pesquisa.
- **URL**
`/surveys`
- **Method:**
`POST`
- **JSON Example:**
```json
{
"title": "Queromos ouvir sua opinião!",
"description": "De 0 à 10, quanto você recomendaria a nossa empresa?"
}
```
- **Success Response:**
- **Code:** 200
**Content:**
```json
{
"id": "eeb3d144-df68-4f5c-8ae2-5d498a2db412",
"title": "Queromos ouvir sua opinião!",
"description": "De 0 à 10, quanto você recomendaria o Henrique?",
"created_at": "2021-02-25T16:31:06.000Z"
}
```
---
## List All Surveys
Listar todas pesquisas criadas.
- **URL**
`/surveys`
- **Method:**
`GET`
- **Success Response:**
- **Code:** 200
**Content:**
```json
[
{
"id": "eeb3d144-df68-4f5c-8ae2-5d498a2db412",
"title": "Queromos ouvir sua opinião!",
"description": "De 0 à 10, quanto você recomendaria a nossa empresa?",
"created_at": "2021-02-25T16:31:06.000Z"
}
]
```
---
# User
## Create User
Esse End-Point permite a criação de usuários.
- **URL**
`/users`
- **Method:**
`POST`
- **JSON Example:**
```json
{
"name": "Henrique Tavares",
"email": "henrique@email.com"
}
```
- **Success Response:**
- **Code:** 200
**Content:**
```json
{
"id": "3e837e85-90d2-4da0-8ce4-91e575d28c54",
"name": "Henrique Tavares",
"email": "henrique@email.com",
"created_at": "2021-02-28T21:24:14.000Z"
}
```
---
# :computer: Tecnologias
Este projeto foi feito utilizando as seguintes tecnologias:
- [NodeJS](https://github.com/nodejs/node)
- [Express](https://github.com/expressjs/express)
- [TypeScript](https://github.com/microsoft/TypeScript)
- [express-async-errors](https://github.com/davidbanham/express-async-errors)
- [handlebars](https://github.com/handlebars-lang/handlebars.js)
- [nodemailer](https://github.com/nodemailer/nodemailer)
- [reflect-metadata](https://github.com/rbuckton/reflect-metadata)
- [sqlite3](https://github.com/sqlite/sqlite)
- [uuid](https://github.com/uuidjs/uuid)
- [yup](https://github.com/jquense/yup)
- [jest](https://jestjs.io/)
- [supertest](https://github.com/visionmedia/supertest)
- [ts-jest](https://github.com/kulshekhar/ts-jest)
- [ts-node-dev](https://github.com/wclr/ts-node-dev)
# :construction_worker: Executando
**Passo 1:**
```bash
# Clone o Repositório
$ git@github.com:tavareshenrique/nps-api-nlw.git
```
**Passo 2:**
```bash
# Baixe as dependências
yarn
```
**Passo 3:**
```bash
# Execute o projeto
yarn dev
```
# :computer: Autores
Henrique Tavares
@tavareshenrique
💻
Rocketseat
@Rocketseat
🚀
# :closed_book: Licença
Este projeto está sob a licença [MIT](./LICENSE).