Server layer built with Typescript, Node JS, Express and Mongoose.
- Set up
.env, as per the.env.examplefile (contact [email protected] for assistance) - Run
yarn install(requiresnode ^17.0.1&yarn ^1.22.10) - Run
yarn dev
-
POST
/api/user/saltwith body:sha--> Fetches the 1st level salt of the voter for client-side hashing. -
POST
/api/user/loginwith body:sha&hash--> (voterAuth) --> Authenticates the voter through middleware.
-
GET
/api/vote/status--> Returns whether voting is open, closed, or hasn't started. -
GET
/api/vote/candidates--> Returns the list of candidates to client. -
POST
/api/vote/submitwith body:sha&hash&poll--> (voterAuth) --> Inserts the voter'spolldata in DB.
yarn dev- Compiles TS with watch tag & starts the server on port 5000 with nodemonyarn clean- Removes the/distdirectoryyarn build- Compiles TSyarn start- Starts the server on port 5000 with node (Mostly used by Heroku)yarn populate- Populates DB with voter data & fires emails through MailGunyarn lint- Scans the repo for any eslint violationsyarn lint:fix- Fixes eslint violationsyarn prettier- Reformats code to Prettier standards & fixes eslint violations
For any assistance, contact [email protected].
- Update
elections-backend/assets/candidates.tsto include all the candidates running for the current term. Example:
FNCE: [{ name: 'Omer Abubaker', val: 'abubaker' }]; // `val` is always the candidate's last name- Verify that the environment variables are correctly set up in the Production & Development Environment of the elections-backend Heroku Pipeline.
- Update the
candidatesPagesection inelections-frontend/src/locale/en.jsonandelections-frontend/src/locale/fr.json. For each candidate, add their platforms in that object, using their last name as the object key. Example:
"candidatesPage": { // An example of what the en.json file would look like
"subtitle": "You can access the platforms of the candidates running for the CSSA 20__-20__ term below.",
"abubaker": "Omer's english platform \n This is a new line",
"mahanna": "Anthony's english platform"
}-
Add the image of each candidate under the
public/candidates/directory. The format must be JPG, and must be passed through the following image resizer first: https://www.onlineresizeimage.com/instagram-profile-picture-resizer/. If the resizer saysimage is too small, then increase the pixel size first through this website: https://www.resizepixel.com/. -
Verify that the environment variables are correctly set up in the Production & Development Environments of the elections-frontend Heroku Pipeline.
