Big Picture Stuff
Repo URL - https://github.com/ChadWKirk/PicPocket
PicPocket URL - https://PicPoccket.com/ (Yes, the URL has 2 C’s in pocket.)
Hosting and Git workflow:
Frontend is hosted on Netlify:
-
Install Netlify CLI in client folder - Get started with Netlify CLI
-
cd client
>npm run build
-
netlify deploy
./build
-
netlify deploy --prod
./build
Important:
Have domain variable in App.js to toggle between using localhost for fetch routes or heroku domain for fetch routes to make it easier to develop. Use domain - localhost when developing, but switch to domain = heroku when building.
Backend is hosted on Heroku:
-
Install Heroku CLI in server folder - Heroku - Deploying with Git
-
cd server
-
git add .
-
git commit -am "message"
-
git push heroku main
Email:
Email is done by Zoho and is connected to the https://picpoccket.com domain.
Routing:
Front End:
-
Uses react-router-dom
npm i react-router-dom
-
Surround App in BrowserRouter in index.js
-
Uses Routes and Route from RRD in App.js to decide which JS file (aka page) is shown when browser is in certain route (ex. “/Signup”)
-
Footer component is outside of routes because it’s on every page
Back End:
-
To retrieve and/or manipulate data, uses fetch API unless Axios is required to use things like Multer for image upload
App.js states:
The states in App.js are there so one page can change a state and then it will get passed to a completely different page.
For example: User goes to UserSettingsPage > Deletes their account > sets isJustDeleted to true (resides in App.js) > gets navigated to MainPage (navigate doesn’t rerender/re-initiate state so it stays true) > if isJustDeleted is true, show account deleted banner.
How Images Work:
- Uses Cloudinary CDN to host images and also .zip files when user mass downloads in the My Pics page