ee-in / andvote

:ballot_box_with_check: Source code for www.andvote.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

☑️ &Vote

Documentation

Poll

Create

POST /api/poll
Parameters
Name Type Notes
question string Required
options array Required. Must contain at least two elements
{
  "question": "What is the best editor?",
  "options": [
    "Vim",
    "Emacs"
  ]
}
Response

If the poll was successfully created:

Status 201
{
  "createdPollId": 1
}

If something wrong:

Status 500
{
  "message": "An internal server error occured"
}

Read

GET /api/poll/:pollId
Response

If the poll was found:

Status 200
{
  "question": "What video should I make next?",
  "options": [
    {
      "pollOptionId": 1,
      "text": "Advanced React",
      "votes": 0
    },
    {
      "pollOptionId": 2,
      "text": "Arrow Functions Tutorial",
      "votes": 0
    },
    {
      "pollOptionId": 3,
      "text": "Arch Linux Tutorial",
      "votes": 0
    }
  ]
}

If the poll cannot be found:

Status 404

If something wrong:

Status 500
{
  "message": "An internal server error occured"
}

Vote

Create

POST /api/vote
Parameters
Name Type Notes
pollOptionId number Required.
Response

If vote was successfully created:

Status 201
{
  "pollOptionId": 1
}

If user has already voted on poll:

Status 400
{
  "message": "You've already voted on this poll."
}

If something wrong:

Status 500
{
  "message": "An internal server error occured"
}

About

:ballot_box_with_check: Source code for www.andvote.com


Languages

Language:JavaScript 95.8%Language:HTML 4.2%