Build a Voting application (freeCodeCamp's Challenge)
- API
- Generics
- Creating polls
- Updating polls
- Polls (get list of polls)
- Poll (get single poll)
- Delete poll
- Vote api
- Authorization
Meta contains user session information
Response codes are 500 internal err, 403 forbidden, 200 ok.
Request:
POST /api/poll
@data { title : title , variants : [{ title : title, voted : 0}]}
Response:
200 Ok
{}
Request:
POST /api/poll/:id
@data { title : title , variants : [{ title : title, voted : 0}]}
Response:
200 Ok
{}
List of all available Polls
Request:
GET /api/polls
Response:
{
data : [ polls ]
meta : {some-meta-info}
}
Get one poll
Request:
GET /api/poll/:id
Response:
{
data : {poll-data}
meta : {some-meta-info}
}
Request:
DELETE /api/poll/:id
Response:
200 ok
{}
Vote for a poll variant
Request:
POST /api/vote
@param id (id of the poll)
@param variant (variant title)
Reponse:
200 OK
{}
GitHub user authorization.
GET (redirect) /api/auth/login