Yelpcamp Docs
Order of app creation
Phase One
- Setup basic Express and EJS app
- Setup basic Mongoose Models and connect to a MongoDb db
- Create some dummy data in the code to run and check the db in the Mongo shell
- Seed DB with data connecting to Mongo DB, Mongoose and models seperately from the rest of the app.
- We run this file everytime we make changes to our models or data to seed the db for testing
purposes.
- Add basic CRUD operations
Phase Two
- Add basic design/styles (Mainly partials such as navs and footers to avoid duplicating
code)
- Use EJS Mate for boilerplate templating
Phase Three
- Handle errors and validating data
- Client side form validations
- Basic error handling
- catchAsync wrapper function
- Defining ExpressError class
- Defining error templates
- Server side validations with Joi middleware
- Joi helps us validate data on server side and throw specific errors easily.
Phase Four
- Adding a reviews model for the reviews feature for campgrounds
Phase Five
- Restructuring Express routes
- Serve static assets (creating a public folder for all JS scripts, CSS files, images and other static
assets.)
- Adding sessions
- Adding flash messages
Phase Six
- Adding authentication
- Create a user model
- Configue passport
- Set up the register form and route
- Set up the login form and route
- Keep a user logged in with isLoggedIn middleware
- Adding logout functionality
Phase Seven
- Configuring Authorization (what users should have / not have access to)
Phase Eight
- Build the rest of the apps features
Phase Nine
- Clean up styles/app
- Fix common security issues
- Mongo/SQL injection
- Cross site scripting (XSS)
- Changes to cookies
- Hiding error stack trace in production
- Using helmet npm package
Phase Ten
- Deploying
- Deploy DB to servers using Mongo Atlas
- Build first cluster
- Create db user
- Add my IP address to list of approved IPs
- Connect to DB through application
- copy db URL
- Paste URL in .env file and paste the user password into URL where is says
password
- In app.js write a const dbUrl = process.env.DB_URL
- Replace URL in Mongoose.connect to dbUrl
- Configure to store session information in Mongo
- Install connect mongo npm package
- Require package
- Configure store in sessionConfig
- Deploy app
- Change dbs to be live db OR local
- Change db secret to be .env secret OR dev secret
- Create .gitignore file and include node_modules and .env