- Setup (Express, EJS)
- Add Landing Page ("/")
- Add Campgrounds Page that lists all campgrounds ("/campgrounds")
- Each Campground is an object that has:
- Name
- Image
- Each Campground is an object that has:
- Create header and footer partials and include them
- Add in Bootstrap
- Setup new campground POST route ("/campgrounds")
- Get data from form and add to campground
- Redirect back to campground
- Add in body parser
- Setup route to show form ("/campgrounds/new")
- Add basic form
- Move campground array to global so that new campground route can access it
- Add a better header/title
- Make campgrounds display in a grid
- Add a navbar to all templates
- Style the new campground form
- Install and configure mongoose
- Setup campground model
- Use campground routes inside our routes
- Add the description to our campground model
- Show db.collection.drop()
- Add a show route/template
- Create a models directory
- Use module.exports
- Require everything correctly
A Seeds file grants us some sample data for testing of functionalities
- Add a seeds.js file
- Run the seeds file every time the server starts
- Create models/comment.js
- Display comments on every campground show page
- Nested Routes The comment route should not exist standalone (i.e. comments/new) as they depend on the campground and the particular id. As such, we have to nest the comments within the campgrounds path:
- Moved EJS files to campground and comment directories, and updated partials to reflect correct directory
- Add the comment new and create routes
- Add the new comment form
- Add a sidebar to show page
- Display comments nicely
- Make a new stylesheet public/stylesheets/main.css
- Serve the public directory in app.js (__dirname)
- Link to the stylesheet in header.ejs
- Install all packages needed for authentication
- Define User model
- Configure Passport
- Add register routes
- Add register template
- Add login routes
- Add login template
- Add logout route
- Prevent user from adding a comment if not signed in
- Add links to navbar
- Show/hide auth links correctly
- Using req.user
- Use the Express router to reorganise all routes
- Associate users and comments by adding author as an object in the comment schema
- Save author's name to a comment automatically via comment.js
- Prevent an unauthenticated user from creating a campground using middleware
- Save username + id to newly created campground
- Add Method-Override
- Add Edit Route for Campgrounds
- Add Link to Edit Page
- Add Update Route
- Add Destroy Route
- Add Delete Button
- User can only edit his/her campgrounds
- User can only delete his/her campgrounds
- Hide/Show edit and delete buttons
- Add Edit route for comments
- Add Edit button
- Add Update Route
- Add Destroy route
- Add Delete Button
- User can only edit his/her comments
- User can only delete his/her comments
- Hide/Show edit and delete buttons
- Refactor Middleware
-
Install and configure connect-flash
// middleware/index.js middlewareObj.isLoggedIn = function(req, res, next){ if (req.isAuthenticated()){ return next(); } **req.flash("error", "Please login first")** res.redirect("/login") }
-
Add bootstrap alerts to header
- Adding styles into CSS to enable slideshow functionality with fading effects
- Altering the show page and edit/new forms, campgrounds route and campgrounds model
-
Get Google Maps API Key
-
Restrict Google Maps API Key
-
Enable Geocoding API
-
Get another key for Geocoding API
-
Add to application as ENV variable
-
Add Google Maps scripts to application
-
Display the campground location in show.ejs
-
Update campground model
-
Update new and edit forms
-
Add location input field
-
Update campground routes