4 ms·
> sharing code between client and server Never happens as much as you would think it might, except maybe for some very simple common utility functions. There
by thom_nic 9y ago
> sharing code between client and server
Never happens as much as you would think it might, except maybe for some very simple common utility functions. There is some benefit to consistent tooling (e.g. all you need is node+npm, then `npm i` and `npm run whatever`) for both client and server, but I have yet to find a project or framework that shares even the obvious stuff like domain model classes well.
- ralmidani 9y agoIt has not yet been done successfully, but that does not mean it cannot be done. I have used Django and Ember together for a couple of projects, and having to define model classes twice is extremely wasteful in a large application. Not to mention having to use a third library for client-side validation (Ember does not do validations out-of-the-box), even though Django has most (if not all) the information needed for thorough validation sitting on the server. In lieu of code-sharing, Django REST Framework does have schema generation support, but no major client-side framework supports it yet.