Wednesday 13 September 2017

How do you handle server side effects?

Servers follow a request/response pattern, but sometimes the request will trigger database updates, analytics events, an email to be sent, etc. An action is required, but it mostly has no impact on the response itself and looks like it would be best solved by pulling it out of the normal flow of the request handler.My initial thought is to set up some kind of PubSub or observer pattern (not entirely different than something like Redux, but with no state tree since it's the server). Then route handlers can trigger actions that will cause a side effect to processed.What are you all's thoughts? Am I missing a common pattern to handle this?

Submitted September 13, 2017 at 08:48PM by treyhuffine

No comments:

Post a Comment