From the course: Express Essentials: Build Powerful Web Apps with Node.js

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

What is middleware?

What is middleware?

- [Narrator] When you are using Express, you're going to hear the term middleware quite often. What exactly do we mean when we say middleware? According to the official Express documentation, middleware functions are functions that have access to the request object, the response object and the next function in the applications request response cycle. Middleware performs a number of tasks, executing code, changing the request in response objects, ending the request response cycle, or calling next. The diagram here on the Express documentation outlines the role of each aspect of a middleware function call, each of which we have discussed up to this point. Now that we have a better understanding of the term middleware, let's head back to our editor and take a look at the middleware that we've written up to this point. In our index.js file, if you scroll down to around line 48, where we created a get route that incorporated…

Contents