Polling API using express js and mongodb.
To get started with the project, clone the repository and install the dependencies:
git clone https://github.com/DevMayur/Polling-API
To run this project, you will need to add the following environment variables to your .env file
MONGO_URI
- can be set from mongodb database
Go to the project directory
cd Polling-API
Install dependencies
npm install
Start the server
npm run start
OR
npm run watch
GET /api/questions
POST /api/questions
Parameter | Type | Description |
---|---|---|
title |
string |
Required. Question |
GET /api/questions/{questionId}
DELETE /api/questions/{questionId}
POST /api/questions/{questionId}/options
Parameter | Type | Description |
---|---|---|
text |
string |
Required. Option |
POST /api/questions/{questionId}/options/{optionId}
OR ( following request is added to add vote using get request )
POST /api/questions/{questionId}/options/{optionId}/addVote
DELETE /api/questions/{questionId}/options/{optionId}
This code is built with help of coding ninjas lectures for the skill test.