2 ms·
Out of curiousity, where have you found it useful for code to be portable between client and server? I've been using Node.js/React together for a while, and I
by strken 8y ago
Out of curiousity, where have you found it useful for code to be portable between client and server?
I've been using Node.js/React together for a while, and I haven't found code reuse across client and server to be as important as I initially thought. The only code that I've tended to share is validation and a handful of utilities, which are a tiny proportion of the total, and even for those the business rules aren't always the same.
- simonbw 8y agoI've made a few multiplayer games where players need to keep a game state synchronized with the server. I used redux for state and game logic, and it's been really nice to be able to share the reducers between server and client. This made it so all I had to do to keep all clients in sync was share actions across clients as they happened. I've also found it useful to have TypeScript on client and server to be able to share types between them. Also, when using React, Node on your server makes server-side rendering a lot easier.
- NewsAware 8y agoPersonally not so much in model code, but in typescript interfaces/DTO which are used by both routing-controllers on the server side (additionally generating swagger api docs along the way) and by mobx on the frontend.