Empowering Express with middlewares
In Chapter 1, What is Express?, we learned about Express middlewares and saw how to create one. Now, let's go find out how to include one in our app. Remember we use app.use()
for including middlewares.
Though we can write our own middlewares, we will focus on using one of the middlewares that comes bundled with Express.
For your reference, the following is the list of the middlewares that are available in Express, by default:
Middleware |
Description |
---|---|
|
The app's routing system |
|
Log requests to the server |
|
gzip/deflate support on the server |
|
Basic HTTP authentication |
|
Parse
|
|
Parse
|
|
Get Express Web Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.