/Polling-API

Primary LanguageJavaScript

Polling API

Polling API using express js and mongodb.

Documentation

Check out the live API & docs

Getting Started

To get started with the project, clone the repository and install the dependencies:

git clone https://github.com/DevMayur/Polling-API

Environment Variables

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

Run Locally

Go to the project directory

  cd Polling-API

Install dependencies

  npm install

Start the server

  npm run start

OR

  npm run watch

API Reference

Get all questions

  GET /api/questions

Create a question

  POST /api/questions
Parameter Type Description
title string Required. Question

Get a question

  GET /api/questions/{questionId}

Delete a question

  DELETE /api/questions/{questionId}

Create an option

  POST /api/questions/{questionId}/options
Parameter Type Description
text string Required. Option

Add a vote

  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 an option

  DELETE /api/questions/{questionId}/options/{optionId}

Authors

✨ Motive

This code is built with help of coding ninjas lectures for the skill test.