My Dev Skills - Part 2
Intro
In the last lesson you saw how to use HTML forms and Express middleware, such as:
express.urlencodedmethod-override
to perform Create, Update & Delete data operations in an Express application.
This lab builds upon the express-dev-skills project you created in the My Dev Skills - Part 1 lab where the Read data operation was implemented.
This Lab is a Deliverable
Exercises
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:
- Display an Add Skill link on the index view that when clicked, displays a new view that displays a form for entering a new Dev Skill.
- When a new Dev Skill is submitted, the skill is added to the "database" and redirect the user to the index view.
- On the show view, display a Delete Skill link that when clicked, deletes the skill from the "database" and redirects to the index view.
Note: All routes should follow those described in the RESTful/Resourceful routing chart
Hints
- Be sure to install, require & mount the
method-overridemiddleware.
Bonus Exercises
- 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.
Hints
- The controller action will need to get the Dev Skill being edited using the
SkillModel and pass it to the edit view. - Pre-fill
<input>elements by using thevalueattribute and some EJS tags to write out the data properties of the skill passed in.