Full Stack App
- In the terminal:
- npm init
- npm install express ejs --save
- initialize app to listen for request on localhost:3000
- create root route with ejs template:
- Add Landing Page route using EJS
- Add Campgrounds Page route that lists campgrounds
- Name
- Image
-
an array and each item in the array is an object
-
each one has a name and image in key val pairs:
- [ {name: "Salmon Creek", image: "http://www.image.com"}, {name: "Salmon Creek", image: "http://www.image.com"}, {name: "Salmon Creek", image: "http://www.image.com"}, {name: "Salmon Creek", image: "http://www.image.com"}, {name: "Salmon Creek", image: "http://www.image.com"} ]
-
- Create our header and footer partials
- Add in Bootstrap
- Setup new campground POST route
- add it to the array
- Add in body-parser
- imported correctly and configured
- Setup route to show form
- so user can send post
- Add basic un-styled form
- Add a better header/tit;e
- make campgrounds display in a grid
- Add a navbar to all templates
- Style the new campground form
###Add Mongoose
- Install and configure Mongoose
- setup campground model
- use campground model inside of our routes!
- required mongoose db
- created and connected to mongoose db called camp_sights
- set up campgrounds schema that for now has a name and Image
- then we compile the schema into a model, ie: code we can use that has a bunch of methods, including find(), create()
- create: where we take data from the form, we make a new obj as a separate step, then we create from that
-
Review the RESTful routes we've seen so far
-
Add description to our campground model
-
Show db.collection.drop()
-
Add a show route/template
- Restfull routes ========================================= name url verb description ========================================= Index /dogs GET display a list of dogs New /dogs/new GET add new dog to database Create /dogs POST add new dog to the db Show /dogs/:id GET Shows info about one dog