NPS is a Restfull API to Net Promoter Score
NPS is a project developed during the Next Level Week presented by Rockeseat.
# Clone this repository
$ git clone https://github.com/Luksdantas/NodeJS-NPS.git
# Access the project folder cmd/terminal
$ cd NodeJS-NPS
# install the dependencies
$ npm install
# Run the application in development mode
$ npm run dev
# Run tests
$ npm test
# The application will open on the port: 3333 - go to http://localhost:3333
POST /users
curl --request POST \
--url http://localhost:3333/users \
--header 'Content-Type: application/json' \
--data '{
"name": "Example Name",
"email": "example@email.com"
}'
{
"id": "uuid",
"name": "Example Name",
"email": "example@email.com",
"created_at": "timestamp"
}
POST /surveys
curl --request POST \
--url http://localhost:3333/surveys \
--header 'Content-Type: application/json' \
--data '{
"title": "Example Survey",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam egestas eu odio vel pharetra. Donec faucibus consectetur ex. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas."
}'
{
"id": "uuid",
"title": "Example Survey",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam egestas eu odio vel pharetra. Donec faucibus consectetur ex. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
"created_at": "timestamp"
}
POST /sendMail
curl --request POST \
--url http://localhost:3333/sendMail \
--header 'Content-Type: application/json' \
--data '{
"email": "example@email.com",
"survey_id": "uuid"
}'
{
"id": "uuid",
"user_id": "uuid",
"survey_id": "uuid",
"value": null,
"created_at": "timestamp",
"user": {
"id": "uuid",
"name": "Example Name",
"email": "example@email.com",
"created_at": "timestamp"
},
"survey": {
"id": "uuid",
"title": "Example Survey",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam egestas eu odio vel pharetra. Donec faucibus consectetur ex. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
"created_at": "timestamp"
}
}
GET /surveys
curl --request GET \
--url http://localhost:3333/surveys
[
{
"id": "uuid",
"title": "Example Survey",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam egestas eu odio vel pharetra. Donec faucibus consectetur ex. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
"created_at": "timestamp"
},
]
GET /answers
curl --request GET \
--url 'http://localhost:3333/answers/:value?u=surveysUserId'
{
"id": "surveyUserId",
"user_id": "uuid",
"survey_id": "uuid",
"value": value,
"created_at": "timestamp"
}
GET /nps
curl --request GET \
--url http://localhost:3333/nps/:surveyId
{
"detractors": 0,
"passives": 0,
"promotors": 0,
"totalAnswers": 0,
"nps": 0
}
Made with β€οΈ by Lucas Dantas ππ½ Get in Touch!