This is a backend application for a voting system where users can vote for candidates. It provides functionalities for user authentication, candidate management, and voting.
- User sign up and login with Voter ID and password.
- User can view the list of candidates.
- User can vote for a candidate (only once).
- Admin can manage candidates (add, update, delete).
- Admin cannot vote.
- System can have only one admin.
- User can view live voting sorted by their vote count.
- Node.js
- Express.js
- MongoDB
- JSON Web Tokens (JWT) for authentication and stateless token based authorization
- Bcrypt for password encryption/decryption
POST /signup
: Sign up a user
POST /login
: Login a user
GET /candidates
: Get the list of candidates
POST /candidates
: Add a new candidate (Admin only)
PUT /candidates/:id
: Update a candidate by ID (Admin only)
DELETE /candidates/:id
: Delete a candidate by ID (Admin only)
GET /candidates/vote/count
: Get the count of votes for each candidate
POST /candidates/vote/:id
: Vote for a candidate (User only)
GET /users/profile
: Get user profile information
PUT /users/profile/password
: Change user password