- Make a folder somewhere on your computer
cdto that folder from the command line- Run
git clone https://github.com/cwojtak/GatorSecurity.gitto clone the repo
Run the following commands from the senior_project_dea-main directory:
npm i mdb-react-ui-kit
Run the following commands from the senior_project_dea-main/server directory:
npm install cors
From the senior_project_dea-main/server directory, do the following:
- Run
touch .envto create a.envfile - Open that file and add the following:
- Note: You will need to replace the first three variables with the correct database credentials and JWT secret
DB_USERNAME=username
DB_PASSWORD=password
JWT_SECRET='secret'
LPORT=5000
- In the
GatorSecuritydirectory (parent tosenior_project_dea-maindirectory) create a.gitignorefile if one does not already exist - Add
.envto thegitignoreto prevent login credentials from being pushed to the repo
If changes are made in the repo, you will need to pull those changes in by doing the following:
cdto thesenior_project_dea-maindirectory (if not already there)- Run
git pull origin main
All work you will ever do in a repo should be done in a branch. In other words, NEVER PUSH TO MAIN! EVER!
There are 2 approaches to creating a branch.
From the senior_project_dea-main directory run git checkout -b <branch-name> (i.e., git checkout -b this-is-my-branch). This will
automatically switch you and all of you changes over to your new branch. See Section 6 for the alternate push command you will need
to run.
- Login to Github and go to
code->branches - Click the
New Branchbutton - Name the branch whatever you like
- Complete steps from Section 4
- Run
git checkout <branch-name>(i.e.,git checkout this-is-my-branch)
If you've made changes locally and you want to commit and push those changes to the repo, do the following:
cdto thesenior_project_dea-maindirectory (if not already there)- Run
git add .to stage all changed files - Run
git commit -m "your commit message"to commit your local changes - Run
git pushto push your changes to the repo (If you created your branch through the terminal, an error will pop up with the alternative command that you need to run the first time you push changes from this branch. The command will look like this,git push --set-upstream origin <branch-name>. Any additional pushes from this branch will only require thegit pushcommand.)
To start the backend run the following commands from the senior_project_dea-main directory:
cd servernpm start
To start the frontend run, open a second terminal in the senior_project_dea-main directory and run npm start.
A database dump with an existing admin user and questions is included with distributions of this project. To see how to import this database dump, refer to MongoDB Setup.pdf in the Resources folder found in the root folder of this repository. The Gator_Security_DB_Dump.zip referred to in this document can be found in the same Resources folder.
The administrative user included in this database dump has a default email admin@localhost and a default password admin that can be changed when using the application while logged in as the admin. It is highly recommended that these default credentials be changed when first using the application.
For the complete backend API documentation, please refer to GatorSecurity Backend API Documentation.pdf in the Resources folder found in the root folder of this repository. Accompanying this documentation are example Postman requests available under the Postman folder in the same Resources folder. You can refer to this document to see how to import these example requests into Postman.
Quick references for how to add questions are below.
Use the question edit page available to admin users to manipulate traditional questions.
First, use the Login example Postman request to login as an admin and obtain a token to perform these operations.
Then, use the documentation and the Create Game example Postman request in order to create a game. If you want it to be a CYOA game, set the type to 0. If you want it to be a DND game, set the type to 1. If you want it to be a Matching game, set the type to 2. Refer to the constants documentation in the PDF for more information.
After creating the game, use the Get Game by Type endpoint using the all type and find the ID of the game that was just created. You'll need to supply this to any CYOA, DND, or Matching questions you create.
Then, use the documentation and either the Create CYOA, Create DND, or Create Matching example Postman requests in order to create subquestions for the game. Make sure that the question type matches the GameQuestion type.
After adding adding new questions, you should be able to refresh the Games page to see the game and play it.