Skip to content
This repository has been archived by the owner on Sep 30, 2019. It is now read-only.

b37t1td/votingapp-freecodecamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voting App freeCodeCamp's challenge

Build a Voting application (freeCodeCamp's Challenge)

Home of the project

Table of Contents

API

Generics

Meta contains user session information

Response codes are 500 internal err, 403 forbidden, 200 ok.

Creating polls

Request:
POST /api/poll
@data { title : title , variants : [{ title : title, voted : 0}]}

Response:
200 Ok
{}

Poll update

Request:
POST /api/poll/:id
@data { title : title , variants : [{ title : title, voted : 0}]}

Response:
200 Ok
{}

Polls

List of all available Polls

Request:

GET /api/polls

Response:
{
  data : [ polls ]
  meta : {some-meta-info}
}

Poll

Get one poll

Request:

GET /api/poll/:id

Response:
{
  data : {poll-data}
  meta : {some-meta-info}
}

Delete Poll

Request:

DELETE /api/poll/:id

Response:
200 ok
{}

Vote

Vote for a poll variant

Request:

POST /api/vote
@param id        (id of the poll)
@param variant   (variant title)

Reponse:
200 OK
{}

Authorization

GitHub user authorization.

GET (redirect) /api/auth/login