Skip to content

kunalkp/Would-You-Rather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Would You Rather Project

A web app that lets a user play the “Would You Rather?” game.

Use

The game goes like this: A user is asked a question in the form: “Would you rather [option A] or [option B] ?”. Answering "neither" or "both" is against the rules.

Installation

To run the project, use these two commands via terminal:

  • install all project dependencies with npm install
  • start the development server with npm start

Data

The _DATA.js file represents a fake database and methods that let you access the data. There are two types of objects stored in our database:

  • Users
  • Questions

Users

Users include:

Attribute Type Description
id String The user’s unique identifier
name String The user’s first name and last name
avatarURL String The path to the image file
questions Array A list of ids of the polling questions this user created
answers Object The object's keys are the ids of each question this user answered. The value of each key is the answer the user selected. It can be either 'optionOne' or 'optionTwo' since each question has two options.

Questions

Questions include:

Attribute Type Description
id String The question’s unique identifier
author String The author’s unique identifier
timestamp String The time when the question was created
optionOne Object The first voting option
optionTwo Object The second voting option

Voting Options

Voting options are attached to questions. They include:

Attribute Type Description
votes Array A list that contains the id of each user who voted for that option
text String The text of the option

The code will talk to the database via 4 methods:

  • _getUsers()
  • _getQuestions()
  • _saveQuestion(question)
  • _saveQuestionAnswer(object)

Library's Used