4 ms·
Yeah, SPA approach would separate the frontend and backend conceptually to different microservices. Frontend is served separately off CDNs, backend isn't invol
by snemvalts 5y ago
Yeah, SPA approach would separate the frontend and backend conceptually to different microservices.
Frontend is served separately off CDNs, backend isn't involved with it. When frontend team decides on a different framework/approach, they can switch, and the frontend just consumes the backend API.
Backend focuses on building an API, doesn't have to deal with templates etc.
The other server side piece doesn't necessarily have to be Node, it can be whatever the backend team wants it to be, Rails is also fine. All it has to do is spit out JSON.
- redbar0n 5y agoI think he wanted to know why you decided that you actually needed React on the front-end, as opposed to doing it «the Rails-way»: HOTwire Stimulus etc.? https://hotwired.dev/ https://hotwired.dev/
- snemvalts 5y agoSome back end devs unwilling to learn React are planning to try it. However as I understand, it's using WebSocket. At my previous job, building a customer service view that used it solely for real time updates, I wouldn't use it for anything critical without some heavy fault tolerance (like checksums or a simple incrementable number to count how many messages have been sent). The messages can be randomly dropped by whatever is in between. I wouldn't want to write in Stimulus as a front-end dev. It looks like writing AngularJS from 2012, way too imperative. Template and logic are also separate which makes legibility harder compared to JSX.
- redbar0n 5y agoAFAIK Hotwire Stimulus isn’t using WebSockets. I think you’re thinking of StimulusReflex. Normal Hotwire Stimulus is just JS controllers that references DOM nodes via CSS tags. Example: https://stimulus.hotwired.dev/ https://stimulus.hotwired.dev/ I agree that JSX is better. Check out Rux which is «A jsx-inspired way to render view components in Ruby» [to make HTML on the server]. https://github.com/camertron/rux https://github.com/camertron/rux