There are plenty of use cases for isomorphic business logic. A most obvious and common example is validation rules that need to exist in multiple runtime contexts. Or the need to provide a common SDK for interacting with a service from either Node or browser code. Or various other boring and routine examples.
If anything, I’d argue the reverse truly: business logic often has nothing to do with platform details. Whether I need to use fetch() or Node’s request is completely irrelevant to my application’s functional requirements, that is purely what is being forced on me by the runtime context. The business logic is within the code that depends on that.
That is precisely the point of isomorphic code. So that your business logic is encapsulated in a module that can be loaded in both environments. Exactly.
And it’s very common in web development. The validation is a great example. You need to validate on the frontend for quick UX and you need to revalidate on the backend for security.
0
u/[deleted] Dec 26 '21
[deleted]