This project is a MVP of a web application for SportCred. It is built using the MERN stack.
Documentation for each sprint can be found in ./docs
.
You will need to run our front end and back end application separately.
- You must have
node
installed and be able to usenpm
- You will also need to configure an
.env
file. A template can be found below.
cd backend
npm install
npm run start
If you want your application to live reload on file changes please install nodemon
by running npm i nodemon
and for step 3 run nodemon ./server.js
instead.
PORT=5000 // The port number should not be changed (unless you plan on updating the front end as well)
DB_URI=mongodb+srv://<username>:<password>@<example>.mongodb.net/<dbname>?retryWrites=true&w=majority //You will need to configure an instance of mongoDB. You can use MongoDB Atlas.
The data model can be found in ./backend/models
.
There is mock data that needs to be imported in order for some features to work (ex: Picks and Predictions)
To do this, you'll need mongoimport which is part of mongo-tools. (https://docs.mongodb.com/manual/reference/program/mongoimport/)
From the root folder of this project (where backend, frontend, and the doc folders are contained), run the following commands.
Local MongoDB Instance:
mongoimport --collection games --jsonArray --file backend/models/import_files/games.json
mongoimport --collection teams --jsonArray --file backend/models/import_files/teams.json
mongoimport --collection winners --jsonArray --file backend/models/import_files/winners.json
mongoimport --collection brackets --jsonArray --file backend/models/import_files/brackets.json
mongoimport --collection triviaquestions --jsonArray --file backend/models/import_files/triviaquestions.json
mongoimport --collection debatequestions --jsonArray --file backend/models/import_files/debate-questions.json
Atlas Instance:
mongoimport --uri "<connection_uri>" --collection games --jsonArray --file backend/models/import_files/games.json
mongoimport --uri "<connection_uri>" --collection teams --jsonArray --file backend/models/import_files/teams.json
mongoimport --uri "<connection_uri>" --collection winners --jsonArray --file backend/models/import_files/winners.json
mongoimport --uri "<connection_uri>" --collection brackets --jsonArray --file backend/models/import_files/brackets.json
mongoimport --uri "<connection_uri>" --collection triviaquestions --jsonArray --file backend/models/import_files/triviaquestions.json
mongoimport --uri "<connection_uri>" --collection debatequestions --jsonArray --file backend/models/import_files/debate-questions.json
# Ex: mongoimport --uri "mongodb+srv://username:[email protected]/mydb" --collection winners --jsonArray --file backend/models/import_files/winners.json
After launching the API, you can visit /api-docs from where the API is hosted to see all possible API calls.
If you need help with this or would like to use a populated database instance please contact any of the contributors on discord.
cd frontend
npm install
npm run start
Since this project was created using create-react-app
more information can be found in ./frontend/README.md
.