1Can you show me a simple Express route that updates a user's profile and uses a middleware to add a `requestTime` property to the request object?
2If you have a middleware that sets `req.isAdmin = true`, how would the subsequent route handler use that to shape its response?
2-5 years experience
1You added a middleware that mutates `req.body` but downstream validation is failing – walk me through how you'd debug the issue.
2Why would placing your request‑editing middleware after the route definition cause the edit endpoint to ignore the changes?
3What are the trade‑offs between mutating the request versus the response in a middleware that handles an edit operation?
5-8 years experience
1In a service with dozens of edit routes, how would you organize middleware to ensure consistent request shaping without hurting performance?
2Describe how you would handle error propagation when a middleware that modifies the response throws an exception in a high‑traffic API.
3How would you design a middleware pipeline that logs every change to request and response objects while avoiding memory leaks?
8+ years experience
1Our team is migrating legacy Express edit routes to a new microservice architecture. How would you refactor existing request‑editing middleware to be reusable across services and maintain backward compatibility?
2What governance, testing, and documentation practices would you put in place to ensure that middleware mutating request/response objects doesn't introduce subtle bugs across multiple teams?
Follow-up Questions
What happens if you forget to call next() in the middleware?
How would you unit‑test that the middleware correctly edits the request object?
Are there any security concerns when mutating req.body in middleware?
Sharethis question
Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.