In this video, learn how to create route handlers with multiple callbacks with a refactor of our parameters example.
- [Instructor] What are route handlers?…They are basically the block of code that happens…inside of your route.…So in a way we've been doing route handling…since we've started this course.…So let me demonstrate.…Let me go inside of the s code,…and then open again, and let's just turn,…shut down the terminal and go inside of index.…Basically any code that we've been doing inside…of a route call, so get on the path forward slash,…this is a route handler.…
This is also a route handler and so on and so forth,…so every piece of code inside of the route…is a route handler.…So basically, this is the piece of code that handles…what that route should be doing.…But in Express there is a neat function we can use…to handle multiple functions, or handlers, within…a single route call.…This function, called next, will also do multiple callbacks.…Let me demonstrate at the same time refactor our get call…we've just done previously.…
Go back to index.js and we'll basically refactor this…particular function here a little bit.…So the first thing I'm going to do is basically…
- Creating a basic data endpoint
- Routing with Express
- Adding a static route for file serving
- Basic middleware with Express
- Built-in middleware and error-handling middleware
- Debugging in an Express application
- Security best practices with Express
Skill Level Beginner
Building RESTful Web APIs with Node.js and Expresswith Emmanuel Henri1h 40m Intermediate
1. Setting Up Express
2. Getting Started
3. Routing with Express
4. Middleware with Express
5. Advanced Topics in Express
- 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.