3 ms·
No, you really don't. What you do, is you write your back end based on the assumption that you have no JS at all, using a server-side MVC framework like Rails o
by NoGravitas 7y ago
No, you really don't. What you do, is you write your back end based on the assumption that you have no JS at all, using a server-side MVC framework like Rails or Django or ASP.NET MVC. Make sure that your controllers and views are well-factored and that you're using partial views where appropriate. It's then almost trivial to apply intercooler to the front-end. In a lot of cases, you don't have to change anything at all in your controllers: just tell intercooler to select out the element you care about from the response (this is most appropriate when a lot of stuff on a page is changing at once, e.g. when you are PJAXing-away a full page refresh). In most others, you usually only have to tell a controller to check whether the request is being made by intercooler, and return a partial view rather than the full view.
The point is that you already have the infrastructure that is generating formatted HTML responses (partial views), and you are now re-using it. If you were trying to write a client-side application from scratch while avoiding the easy path of writing a server-side MVC app, then yeah, I can see how it would be more complex than advertised.
Source: I've built a couple of web apps using intercooler.
- haolez 7y agoWould you still use it today? Sometimes I would like to write simple web apps behind a login page, but the complexity of mainstream frameworks (and their build systems!) makes it not worth it to me.
- NoGravitas 7y agoI have absolutely used it recently, and I find it a pleasure to use.