All Visualizers

Express.js Visualizer

Middleware chain, next() internals, error handling, request lifecycle, routing algorithm, and async patterns

The Middleware Chain

Express is essentially a series of middleware function calls. Every request passes through each middleware in the order they were registered. Each middleware can modify req and res, end the cycle, or call next() to pass control forward.

Client
cors()
json()
auth()
logger()
Route Handler
Response

Key Rules

Sequential Execution

Middleware runs in the exact order of app.use() calls. First registered = first executed.

Must call next() or respond

If middleware doesn't call next() or send a response, the request hangs forever.

Can modify req/res

Each middleware can attach properties (req.user), set headers, transform the body.

Can short-circuit

Any middleware can end the cycle by calling res.send(), res.json(), etc. — skipping the rest.