In this exercise, you must add a number of middleware methods to the server. The middleware will handle incoming lion requests, errors, and additional routing.
(asian music)…- So now what we'll do, is check out the step three.…I'm going to do a stash.…Oh there we go.…If you check out of step three,…and go to server server datas,…it's got a lot of stuff going on here.…
Your objective is to use a new method on the app,…call it params.…So using app.params,…we're going to abstract some common functionality…we've been doing this whole time.…If you notice on our crud routes,…every route that has id property,…we had to find the to do with that id.…A bit of piece of common functionality,…we use a middleware function to do that first,…before it gets to that route.…So by the time that route runs,…we can just access request.lion…and get the appropriate lion,…without having to look for it.…
So that's what we'll do with the app.params,…and I'll so you an example of that, actually ...…Yeah, it should be params, or is it param.…Hold on, let me look.…Don't even know, app dot ...…Oh yeah, it's param, it's param, no pluralize.…You'll use app.param here, which will look for anything,…this function's going to run,…
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?
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.