Giter VIP home page Giter VIP logo

nodejs-nps's Introduction

๐Ÿ˜ž ๐Ÿ˜Ÿ ๐Ÿ˜ ๐Ÿ˜ ๐Ÿ˜ƒ
NPS API

NPS is a Restfull API to Net Promoter Score

Express Version Typeorm Version Sqlite3 Version Yup Version Nodemailer Version Handlebars Version Jest Version Typescript Version

๐Ÿ“About

NPS is a project developed during the Next Level Week presented by Rockeseat.

๐Ÿš€ Getting started

# 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

๐Ÿ›  NPS API

Insomnia document

POST Create User

Request

POST /users

curl --request POST \
  --url http://localhost:3333/users \
  --header 'Content-Type: application/json' \
  --data '{
	"name": "Example Name",
	"email": "[email protected]"
}'

Response

{
  "id": "uuid",
  "name": "Example Name",
  "email": "[email protected]",
  "created_at": "timestamp"
}

POST Create Survey

Request

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."
}'

Response

{
  "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 Send Mail

Request

POST /sendMail

curl --request POST \
  --url http://localhost:3333/sendMail \
  --header 'Content-Type: application/json' \
  --data '{
	"email": "[email protected]",
	"survey_id": "uuid"
}'

Response

{
  "id": "uuid",
  "user_id": "uuid",
  "survey_id": "uuid",
  "value": null,
  "created_at": "timestamp",
  "user": {
    "id": "uuid",
    "name": "Example Name",
    "email": "[email protected]",
    "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 List of Surveys

Request

GET /surveys

curl --request GET \
  --url http://localhost:3333/surveys

Response

[
  {
    "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 Email Answer

Request

GET /answers

curl --request GET \
  --url 'http://localhost:3333/answers/:value?u=surveysUserId'

Response

{
  "id": "surveyUserId",
  "user_id": "uuid",
  "survey_id": "uuid",
  "value": value,
  "created_at": "timestamp"
}

GET NPS

Request

GET /nps

curl --request GET \
  --url http://localhost:3333/nps/:surveyId

Response

{
  "detractors": 0,
  "passives": 0,
  "promotors": 0,
  "totalAnswers": 0,
  "nps": 0
}

๐Ÿ“‘ License

License

Made with โค๏ธ by Lucas Dantas ๐Ÿ‘‹๐Ÿฝ Get in Touch!

nodejs-nps's People

Contributors

lucasdants avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.