Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polls API

A Flask-based web application for creating and managing polls with user authentication, vote tracking, and results visualization.

Features

  • User authentication (login/register)
  • Create and manage polls with multiple options
  • Vote on polls (authenticated users only)
  • View poll results and statistics
  • RESTful API endpoints with JSON responses

Getting Started

Prerequisites

  • Python 3.7+
  • PostgreSQL database

Installation

  1. Clone the repository:

    git clone https://github.com/harploid/polls-api.git
    cd polls-api
  2. Install dependencies:

    pip install -r requirements.txt
  3. Create a .env file:

    cp .env.example .env
  4. Initialize database:

    flask db init
    flask db migrate
    flask db upgrade

Running the Application

flask run

API Endpoints

Authentication

  • POST /auth/register - Register a new user
  • POST /auth/login - Authenticate and get access token

Polls

  • GET /polls - Get all polls
  • POST /polls - Create a new poll
  • GET /polls/<id> - Get details for a specific poll
  • DELETE /polls/<id> - Delete a poll

Votes

  • POST /votes - Submit a vote for a poll option
  • GET /votes - Get all votes (admin only)

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin feature/your-feature)
  5. Create a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages