Working with Middleware

  • Azat Mardan


Middleware is an amazingly useful pattern that allows developers to reuse code within their applications and even share it with others in the form of NPM modules. The essential definition of middleware is a function with three arguments: request (or req), response (res), and next. If you’re writing your own middleware, you can use arbitrary names for arguments, but it’s better to stick to the common naming convention. Here’s an example of how to define your own middleware:


Error Handler Server File Query String Style Sheet Static Asset 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Copyright information

© Azat Mardan 2014

Authors and Affiliations

  • Azat Mardan
    • 1
  1. 1.OaklandUS

Personalised recommendations