This repository contains the backend API for a voting app. It includes endpoints for user authentication, managing candidates, voting, and viewing live election results.
- Manage candidates: Add, update, and delete candidates.
- Signup/Signin: Users and admin can signup and signin using Aadhaar card as a government ID.
- View candidates: Users can see the list of candidates.
- Vote: Users can vote for one candidate.
- Update/Delete their account
- Live updates: Anyone can see live updates of vote counts in sorted order of vote counts.
/users/signup
(POST): Signup for users and admin./users/signin
(POST): Signin for users and admin to receive a JWT token./users/updateuser/:userid
(PATCH)(users & admin update)/users/profile/
(GET)(login required)/users/deleteuser/:userid
(DELETE)(users & admin delete)
/candidates/addcandidate
(POST): Create new candidates. (Admin Authorization required)/candidate/:candidateid
(PATCH): Update a candidate information./candidate/:candidateid
(DELETE): Delete a candidate.
/candidates
(GET): Get the list of candidates./candidates/:id
(GET): Get information of a candidate./vote/:candidateid
(POST): Vote for a candidate. (Voter Authorization required)
/results
(GET): Access live election results. (Public access)
- Node.js
- Express.js
- MongoDB
- Mongoose
- JWT for authentication
- BcryptJs for password encryption/decryption
- Clone the repository.
- Install dependencies:
npm install
- Configure environment variables.
- Start the server:
npm start