A Flask-based web application for creating and managing polls with user authentication, vote tracking, and results visualization.
- 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
- Python 3.7+
- PostgreSQL database
-
Clone the repository:
git clone https://github.com/harploid/polls-api.git cd polls-api -
Install dependencies:
pip install -r requirements.txt
-
Create a
.envfile:cp .env.example .env
-
Initialize database:
flask db init flask db migrate flask db upgrade
flask runPOST /auth/register- Register a new userPOST /auth/login- Authenticate and get access token
GET /polls- Get all pollsPOST /polls- Create a new pollGET /polls/<id>- Get details for a specific pollDELETE /polls/<id>- Delete a poll
POST /votes- Submit a vote for a poll optionGET /votes- Get all votes (admin only)
- Fork the repository
- Create your feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/your-feature) - Create a pull request
This project is licensed under the MIT License - see the LICENSE file for details.