This is an Application where User can create a poll prompting a question and two options. All users can see all polls and vote on the poll that they wish to participate in. Results will be accessible once the poll is closed.
You also provide the 2 options you want user to vote on. All users that navigate through the main page of the app will be able to see all the polls created by all users. The cards on the main page will show how many votes have been casted on that poll, will have buttons, depending on the user, to cast a vote or to close the poll. After a poll is closed (either by the user or when the time the poll was set to run expires) it will allow you to see the results.
- Ruby on Rails
- PostgreSQL
- Auth using JWT and bcrypt
- Sidekiq
- Redis
..* Set up for how many minutes you want your poll to be active for. After the time expires, the poll's status will be changed to in-active and voting will no longer be allowed. The job that takes care of changing the status is run by sidekiq, and queued on a redis server.
..* You are able to see how many votes have been casted in the poll, but you will not be able to see the results until poll is closed.
First, I will begin with the Back end setup. The Front-End repo is here: Front-End Polling App
A new terminal will need to be opened for each server. Make sure the database is created by running rails db:create
Run rails db:migrate
to run the DB migrations.
It is best to seed data. Add to the seed.rb
file then run rails db:seed
; Otherwise app will launch with Empty databases.
- Start up the Rails Server
rails server
- Start Redis Server:
redis-server
- Start Sidekiq:
bundle exec sidekiq
npm start
runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.