/democracy-works-practical

A user is presented with an address form and based on submission a user should see upcoming election information if available.

Primary LanguageJavaScript

Democracy-Works-Upcoming-Elections-Practical-Exercise

Overview A user is presented with an address form and based on submission a user should see upcoming election information if available.

Templates: I decided to use ejs to build a single web app page for easy accessibility for the user, just in case they wanted to submit again.

Testing: I installed Jest for testing. npm run test if you would still like to see.

If you want to run it locally, clone this repository and run npm install. Then, run npm start or node app.js.

Also installed eslint if you like linting. npx eslint name_of_file.js

My helper functions:

  • getElectionsByLocation : takes two string data type parameters that represent the state and place. The responsibility of this function is to query turbovote api with the correctly formatted ocd-ids and format the data that is being return from the promise for the user.
  • generateOcdIds : takes two parameters representing string data type. If only a state is passed in as a value it return a correctly formatted state ocd-id. If both a state and place is passed it also return a correctly formatted state ocd-id with place appended to it.

This app is deployed here