Start by opening a terminal in the base project directory.
Copy and paste the following command into the terminal:
cd client;npm install;cd ../server;npm install;Important
If you did not install MongoDB as a service, open a new terminal and run this command:
mongodThis starts MongoDB and allows the site's files to connect to the database. Do not close this terminal until you've finished using the site.
Now, enter these commands one-by-one:
mongosh "mongodb://127.0.0.1:27017"
use phreddit;
db.createCollection("phreddit");
exitTip
These commands ensure that the initialization script will be able to access the database.
After that finishes, run init.js in Terminal 1 with the following syntax:
node init.js mongodb://127.0.0.1:27017/phreddit <ADMINNAME> <ADMINEMAIL> <ADMINPASSWORD>Tip
Here's an example that initializes the admin account to have username admin, email admin@phreddit.com, and password adminPW:
node init.js mongodb://127.0.0.1:27017/phreddit admin admin@phreddit.com adminPWNow you can run the following command to launch the server on port 8000:
node server.jsFinally, open a new terminal in the base project directory, and run this command to launch the React app:
cd client;npm startAfter the initial setup, if you close all the terminals and then want to start it up again, follow these steps:
Important
If you did not install MongoDB as a service, open a terminal and run this command:
mongodThis starts MongoDB and allows the site's files to connect to the database. Do not close this terminal until you've finished using the site.
Open a new terminal in the base project directory and run:
node server/server.jsOpen another terminal in the base project directory and run:
cd client;npm startWarning
server.js (and mongod, if necessary), must be running for all tests to pass! If no terminals are open, follow the steps in the previous sections.
In a new terminal in the base project directory, enter the following command to run the two server unit tests:
cd server;npm test;cd ..Enter the following command in the base project directory to run the client unit test:
cd client;npm test;cd ..- Full Frontend (All changes to React code since HW3)
- Backend changes + Documentation + Unit Tests


