This chapter introduces the world of Express middleware. You’ve seen how to implement middleware in your code. The parse-body
middleware allows you to parse POST
parameters or JSON data in the body of the request. The static
middleware allows you to set routes to serve static files such as JavaScript, CSS, and images. The cookie-parser
, cookie-session
, and session
middleware allow you to implement cookies and sessions.
In this chapter you’ve also gotten a glimpse of using the middleware framework to implement basic HTTP authentication and more advanced session authentication. A great advantage of Express middleware is that it makes it extremely simple to implement your own middleware functionality.