Read: Class 07 Express - 401-advanced-javascript-muna/amman-javascript-401d1 GitHub Wiki

Express

Express Middleware

  • A series of functions that the request “goes through”
  • Each function receives request, response and next as parameters
  • Types of middleware: Application and Route

Application Middleware

  1. Error Handling
  2. Bringing in other routes
  3. Applies Defaults
  4. JSON, Body and Form Parsing
  5. Runs on every request

Route Middleware

Dealing with specific things for a route Generally, things many routes would participate in Are you logged in? What is your IP? Have we seen you here before? How can we take advantage? Logging Dynamic Model Loading Browser, Location, User specific content Consistent Data Transition/Modeling/Preparation (Pre-Render)