Design Patterns · Junior · Question 21 of 75
Which pattern underlies middleware in Express or Redux?
- ✓Correct answer: Chain of Responsibility
- 2Builder with a
next()method - 3Flyweight for shared handlers
Explanation
A request passes through a sequence of handlers: each can handle it, modify it or pass it to the next via next(). This is how logging, authorization and body parsing are added without changing the main handler.