Your objective in part 1 is to put in a rep doing everything that you did during the Express Routers and Controllers lecture:
- Scaffold a new app named
express-dev-skills
usinge-gen-replacement
(don’t forget to runnpm i
). - Create an array of “fake” data representing some of your awesome developer skills (or another resource of your choice). The specific properties describing a
skill
(or other) object are up to you! - Implement index functionality for the
skills
resource or the resource you chose
- Keep the data resource name short and simple - something like
skills
. - Following best-practice routing and MVC will result in the following modules for the
skills
resource:routes/skills.js
data/skill-data.js
views/skills
controllers/skills.js
- Use RESTful/Resourceful Routing Conventions
Your objective in part 2 is to put in a rep doing everything that you did during the Intro to Mongoose lecture:
- Refactor our app to use Mongoose/MongoDB. No additional functionality is added in this step.
Your objective in part 3 is to put in a rep doing everything that you did during the The Chart and URL/Route Parameters lecture:
-
Display an Add Skill (or resource of your choice) link on the index view that, when clicked, displays a new view with a form to enter a new skill (or another resource of your choice)
-
Allow that form to be submitted, which should create a new document in your database. After submitting this form, redirect the user to the index view.
🚨 You should see data on the index view after this step! -
Implement show functionality for your resource
In Express Middleware, you saw how to use Express middleware, such as:
express.urlencoded
(AKA body-parser middleware)method-override
The goal of the lab is to do put in a rep doing everything that you did during the Express Middleware lesson by adding the following functionality to the express-dev-skills
project:
- On the show view, display a Delete Skill link that deletes the selected document from the database and redirects to the index view when it is clicked.
- Be sure to install, require & mount the
method-override
middleware.
- On the show view, display an Edit Skill link that, when clicked, displays an edit view that displays a form for editing that Dev Skill.
- When the edit Dev Skill form is submitted, the skill should be updated in the “database” and redirect the user back to the show view.
- The controller action will need to get the Dev Skill being edited using the
Skill
Model and pass it to the edit view. - Pre-fill
<input>
elements by using thevalue
attribute and some EJS tags to write out the data properties of the skill passed in.