Skip to content

A Guide to Displaying Question and Answer Cards in the Game

Jackie W. Macharia edited this page Feb 2, 2017 · 3 revisions

Question / Answer Cards Display

You will realize, upon cloning and running this game locally, that the question / answer cards are not available. This is a guide on how to add the question and answer cards to an mLab database and getting the game to fully run locally.

1. Create an mLab database

Refer to the official documentation on how to create an mLab database here. Be sure to set a database user and password.

2. Add collections to the database

Add two collections to the database; one for questions and the other for answers.

3. Add the questions and answers as documents in the respective collections

You can do this in either of two ways:

  • Directly add the documents in the respective collections on the mLab database.
  • Use a MongoDB management tool like Robomongo to both create and add documents to the respective collections.

Question and answer files used for this project are available here

4. Set the database in your local .env file

In your .env file, set your database to point to the mLab database:
MONGOHQ_URL=mongodb://<dbuser>:<dbpassword>@ds139899.mlab.com:39899/wiki-example
Where <dbuser> is the database user and <dbpassword> is the database password.

Remember to also use the same database URL for your deployments.

5. Run the app, go crazy!