Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Express Basics!
You have completed Express Basics!
Preview
You've already been using it, now learn what Express middleware is!
Documentation
Basic form of Express middleware
(req, res, next) => {
// do something
next();
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
We use the body parser to
post incoming form data and
0:00
the cookie parser to
read cookie information.
0:03
But that's not all you
can do with Middleware.
0:07
In fact, Middleware is so
integral to Express,
0:09
just about everything you write
in Express is Middleware.
0:12
So what is it?
0:15
Consider when someone asks you a question,
you hear the question, think about it for
0:16
a moment, and then answer the question.
0:21
If we relate this to the request
response cycle, that middle step,
0:24
the thinking,
is analogous to what Middleware does.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up