Skip to content

An API where anyone can create questions with options and also add votes to it

Notifications You must be signed in to change notification settings

hi-masd/Polling_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polling_api

Task: Need to create an API where anyone can create questions with options and also add votes to it


Features

  • Create a question
  • Add options to a question
  • Add a vote to an option of question
  • Delete a question → (optional: A question can’t be deleted if one of it’s options has votes)
  • Delete an option → (optional: An option can’t be deleted if it has even one vote given to it)
  • View a question with it’s options and all the votes given to it

Required Routes

  • /questions/create (To create a question)
  • /questions/:id/options/create (To add options to a specific question)
  • /questions/:id/delete (To delete a question)
  • /options/:id/delete (To delete an option)
  • /options/:id/add_vote (To increment the count of votes)
  • /questions/:id (To view a question and it’s options)

Folder Structure

CSV_Upload/
|── |config/
│   |      ├── mongoose.js
|   |
├── routes/
│   |      ├── api/
│   ├── index.js
|   |
├── controllers/
│   ├── OptionsController.js
│   ├── QuestionsController.js
|   |
├── models/
│   ├── options.js
│   ├── questions.js
|   |
├── package-lock.json
├── package.json
├── README.md

About

An API where anyone can create questions with options and also add votes to it

Topics

Resources

Stars

Watchers

Forks