- In the Command Line, navigate to the directory idm372
- Download node_modules using:
npm install - Install nodemon globally using
npm i nodemon -g - Fix any npm issues by running
npm audit fix - Go to Microsoft Teams and download the
secret/folder and the.envfile from the General Channel > Files Tab >Back End Development/Secret Keys/ - Copy both the folder and file to the root of the project.
- Downloading the
.envfile from Teams will likely rename it to justenv, name it back to.env
- Run the command
nodemon server.jsto startup the express server- nodemon watches the files for changes and refreshes the server
- if you run into an error saying "Cannot be loaded because running scripts is disabled on this system":
-
- hit
CTRL/CMD + SHIFT + Pand typesettings
- hit
-
- next open
Prefences: Open Settings (JSON)
- next open
-
- add this line inside of the brackets
"terminal.integrated.shellArgs.windows": ["-ExecutionPolicy", "Bypass"]
- add this line inside of the brackets
-
- save this file and restart VSCode
-
- re-run the command
- The server will then be running on
localhost:8888 - In a new terminal tab/window, run the command
npm run devto build the files for development- Webpack will compile all files and watch for changes on save
- Go to
localhost:8888in your preferred browser to view the build
- !!! Before making any changes, branch off of the main using
git checkout -b (insert issue name here)(make sure you pull first usinggit pull origin main) - If you see any issues or are assigned a task for the week, create a ticket/issue for it
- !!! Create a new branch for your work titled the same as the ticket issue e.g.
git checkout -b Issue-#7– this will sync the commits with the ticket so you can reference them in a pull request to show the changes that were fixed/worked on- When pushing changes from the branch use
git push --set-upstream origin *branch name*
- When pushing changes from the branch use
- Make sure you create a pull request when finished
- For organization of the repo, use emojis when writing commits messages e.g.
:lipstick: styled footer navigation - Using emojis on commit messages provides an easy way of identifying the purpose or intention of a commit
- For organization of the repo, use emojis when writing commits messages e.g.
- All pages live inside the
viewsfolder at the root and use the.ejstemplating language - The url, page title, and location of the
.ejstemplates are stored as values insrc/scripts/config/endpoints.json- This allows us to dynamically changes these values globally so that we don't have to manually change each value on each template e.g.
endpoints.pages.registerAnthem.url
- This allows us to dynamically changes these values globally so that we don't have to manually change each value on each template e.g.
- In
src/scripts/routes, there is a file calledroutes.jswhich renders these pages
- Create a new
.ejstemplate for the page you want to create e.g.chat.ejs - In
src/scripts/routes/routes.js, create a new function for this page underneath the others (using formatting as a reference)- Use
res.renderto load up an.ejsview file
- Use
- All styles use Sass |
.scss- View the link to learn about nesting, partials, variables, extending, etc.
src/styles/main.scssis the master file for all of these files, webpack will import all of the partials into this this file and compile them into a.cssfile inpublic/dist/css(this will be re-compiled everytime you save)- Each partial is broken out based on function, use this format for creating new files
- If you are running into terminal errors for express or webpack, try re-running the commands for each
- Express:
nodemon server.js - Webpack:
npm run dev
- Express:
- Helpful VSCode plugins TODO Highlight & Todo Tree
- These allow you to leave notes in certain areas of the project as a TODO list so you can come back to it later
- Todo Tree adds a sidebar icon to VSCode which shows where every TODO note you left is so you can keep track of what's left