Express 4.x allows for more than one router in an application. This means developers can use a router in a more modular way. A router can have its own routing, stack, and functionality. Scott demonstrates this by showing a code snippet with an encapsulated todosRouter.
- So, routers are awesome.…This entire time, we've been using the actual…like Express application for our router,…which works great, as you can see.…But with the introduction of Express 4,…they introduced subrouters,…or just application routers in general.…You can think of a router as…a piece of routing functionality…and it's own middleware stack.…So, right now, we have this application level,…middleware stack, so everything in the application…runs through this, but with a router,…we can isolate an entirely different set of rules,…as far as middleware and routes…and isolate it, completely separate.…
Think of it as like a component of routers.…It's like its own little server inside of a server.…It still uses its parent's middleware…but it also has its own middleware…that nobody else uses.…You'll see as we start routing,…as we start writing it, how that makes sense,…and why it's amazing.…So, this is why I was saying that Express 4…is actually really good contender as far as…like writing an API, whereas Express 3…was kind of limited, 'cuz it didn't have that.…
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.