← Back to design patterns map
⛓️
Design Pattern

Chain of Responsibility

Pass a request through handlers until one handles it.

behavioral

Visual Diagram

Request
-> auth
-> validation
-> controller
-> response

When To Use

  • ->Express, Koa, or Fastify middleware chains
  • ->Validation pipelines
  • ->Approval workflows
  • ->Support escalation flows
Used in: Express middleware, Koa middleware, error pipelines
chain.js

Live Editor

Loading...

Output

Run code to see output...