Skip to content
Denver Brian edited this page Nov 5, 2023 · 2 revisions

BACKEND APIs

GET ALL POLLS

This api is primarily used for getting all the results from a given poll.

 GET /api/v1/polls       

Response

Returns Description
status Represents the status of the request
message Message from the server.
data Returns an array of poll objects.

Example Usage

const polls = await fetch('/api/v1/polls').then((data) => data.json());
const pollList = polls.data;

Example Response

{
    "status": "success",
    "message": "Polls retrieved successfully.",
    "data": [
        {
            "id": 1,
            "pollDescription": "Who will win this Hackathon?"
        },
        {
            "id": 2,
            "pollDescription": "What is the best language?"
        }
    ]
}

Quick Links

Clone this wiki locally