In Express 4.x, there are five different types of middleware: third party, router, application, error-handling, and built-in. Scott explains a few of these types and shares a few code examples of their use. He also spends some time talking in-depth about error handling.
(asian music)…- [Scott] Now we're going to talk…about the different types of middleware in Express 4.…So we're using Express 4.0, which is really awesome,…but there are five different types…of middleware in Express 4.…There are third-party middleware,…which is like bodyPraser and this stuff,…this stuff that we npm installed.…There's third-party middleware.…There's router-level middleware.…We haven't gotten to that,…but we'll get to that later today actually.…
So we'll get into router-level middleware.…There's application-level middleware,…which is what we've been using this entire time,…which is this.…Because when we do the app.use,…we're saying this entire application instance…is going to use this middleware right here.…It doesn't matter what router,…it doesn't matter what.…Whenever a request comes in,…it's always going to run through here first.…And it's always going to go through here second,…and it's always going to go through here third,…no matter what.…No matter what middleware we put down here,…on another file, on another file,…
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.