Scott finishes his explanation of the second exercise by covering the PUT and DELETE routes which update and remove lions.
(bold music)…- [Instructor] The PUT - little trick here.…Lot of stuff going on here,…so PUT is ...…Let's go back and look at our blueprint.…It should update and return the matching lion…with the posted update object.…So that means is, one,…I'm expecting an object…to come in from the client with some properties…that I need to first,…find a line with a matching ID…and if I do, update that line with the object…that I was given.…
So, I'm doing a few things here.…One, first, I'm going to grab the update,…which is on req.body.…So that can be an object with any property on it…that we want to update the lion with.…So the name, the pride, the age, the gender,…pretty much anything but the ID.…And then, just for a safety check,…just in case you tried to update the ID,…I'm just going to delete the ID…just in case you tried to update the ID,…so we don't have things with two of the same ID's…and stuff like that.…You don't want to change the ID, the database…is in charge of the ID stuff, so,…I deleted the ID off the update object…
This course was created by Frontend Masters. It was originally released on 12/30/2015. We're pleased to host this training in our library.
- Executing Node.js
- Using Express
- What is middleware?
- Testing in Node.js
- Using Mongo with Node.js
- Data modeling
- Querying data with Mongoose
- Identifying sensitive routes
- Configuring the deployment
Skill Level Intermediate
Node.js: Build Your First Microservicewith Daniel Khan2h 9m Intermediate
Building APIs Using Hapi in Node.jswith Kirsten Hunter2h 23m Intermediate
2. REST APIs
5. Organization and Configuration
7. Data Modeling
10. Securing Routes
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.