Middleware and Its Types

Learn about middleware and what its types are.

Middleware is set of functions that run before or after an HTTP request hits the router. Middleware can be stacked together. We can also update the request and response from middleware. We can create global middleware for all the routes or create custom named middleware for specific routes.

Middlewares are separated into three types:

  • Server
  • Global
  • Named

Get hands-on with 1400+ tech skills courses.