A web app that lets a user play the “Would You Rather?” game.
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.
To run the project, use these two commands via terminal:
- install all project dependencies with
npm install
- start the development server with
npm start
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 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 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 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)