Live data from Hacker News

Ask HN: What companies are embracing “HTML over the wire”?

news.ycombinator.com

71–80 of 192 posts

Re: Ask HN: What companies are embracing “HTML over the wire”?

#71

I'm building a webapp[0] for turning Clickup docs into static sites, using CF Workers. There isn't a framework for Workers that has the flexibility I need, so I home-rolled one that only sends rendered HTML over the wire. Async components are supported too, so if I have a particularly data-intensive component the renderer just inlines a tiny JS script that sends a request to the worker again, which then returns just…

ColdFusion!!! Nice!!!

CF = Cloudflare. I would hope nobody is still writing things in ColdFusion these days :-)

Re: Ask HN: What companies are embracing “HTML over the wire”?

#72
post #50

We are using Django+HTMX for internal applications. Some random tips: - Write a "Django context processor" to inspect requests for "Hx-Request" header, and set a "base_template" variable accordingly. This means that any template that {% extends base_template %} will react to being a full page or just a fragment and you don't even have to think about that in your view logic. Great for progressive enhancement. - You ca…

do you have any code examples you'd be able to share that uses the base_template thing?

Re: Ask HN: What companies are embracing “HTML over the wire”?

#73
post #44

Earlier quoted context omitted.

IF you want the page to be interactive without refreshes though, you gotta do something. Unless you are advocating a completely pre-ajax web. https://en.wikipedia.org/wiki/Ajax_(programming)

Why are refreshes assumed to be bad?

Refreshes can be very fast, and often essentially invisible in modern browsers, when you don't bloat the page unnecessarily, but I think AJAX still has a use for things like the voting button on HN or "add to cart" buttons in a web shop. It would be annoying to lose the scroll position (and perhaps other state) for each item you want to add/upvote.

(Although modern sites that try to sweep latency under the rug by immediately updating the state on the client side and later reverting the change when the server responds are perhaps more annoying.)

Re: Ask HN: What companies are embracing “HTML over the wire”?

#74

old man alert Back in my day, we wrote ASP.NET that was all server-side-rendered HTML. Once in a while we got REAL FANCY and used JQuery to make PARTIAL HTML requests and update only FRAGMENTS of the page. Hooboy I knew that fashion was cyclical but not tech!

Same. AJAX was around, but quite new. Browser JS engines were hit and miss speed wise. Creating elements in the dom could be super slow depending on the browser. My solution then was to have the server send html as a string and then drop it into an existing element. Felt super hacky at the time haha.

Re: Ask HN: What companies are embracing “HTML over the wire”?

#75
post #5

Earlier quoted context omitted.

It is rendered server side, but typically the server keeps track of only what needs to change and sends as small as possible an update to dynamically update the DOM. You end up with a user experience that feels close to an SPA, but a dev experience that feels close to traditional SSR.

Having only worked at SPA places, it's hard for me to imagine not having tools like Storybook, Chromatic, and Mocked Service Workers. Building the UI in isolation means with mocked API responses means I can, in parallel, validate 1000's of use cases with pixel-level precision. The backend teams can keep their focus on scalable, performant APIs. The frontend teams can focus on accessibility, consistency, etc. I've fou…

We do browser based end-to-end testing which tests the frontend and backend at the same time using a single tool (Capybara in our case). We take snapshots at various points during the test runs which are then compared to previous runs for visual regression testing.

Nothing is isolated so it's probably slower. The tradeoff is that the tests are really simple for how much they cover, and they're entirely separate from the implementation details so refactoring/changing technologies becomes really easy. It's an old project and we've incrementally migrated from jQuery to Backbone to React to Stimulus with the same tests. Conceivably we could change the app to a SPA and keep the tests.

I have no way to really know if it's better than anything else (though I am interested in that question!), but I think it has worked out pretty well for us. One metric might be that our main app has been around for 10+ years, we're still delivering features daily, and nobody is complaining about a rewrite.

Re: Ask HN: What companies are embracing “HTML over the wire”?

#76
post #51

Earlier quoted context omitted.

A bit of Ajax here and there is fine. Look at how HN handles it when you upvote/unvote a comment. Look at how old.reddit.com handles it when you click "load more comments" in a long thread.

isnt ajax fancy sending html over the wire? or is it just the non fancy way?

AJAX was the original name for doing asynchronous Javascript calls to a server.

Re: Ask HN: What companies are embracing “HTML over the wire”?

#78
post #71

Earlier quoted context omitted.

ColdFusion!!! Nice!!!

CF = Cloudflare. I would hope nobody is still writing things in ColdFusion these days :-)

the client i'm working with right now uses ColdFusion extensively.

Re: Ask HN: What companies are embracing “HTML over the wire”?

#79
post #5

Earlier quoted context omitted.

It is rendered server side, but typically the server keeps track of only what needs to change and sends as small as possible an update to dynamically update the DOM. You end up with a user experience that feels close to an SPA, but a dev experience that feels close to traditional SSR.

Having only worked at SPA places, it's hard for me to imagine not having tools like Storybook, Chromatic, and Mocked Service Workers. Building the UI in isolation means with mocked API responses means I can, in parallel, validate 1000's of use cases with pixel-level precision. The backend teams can keep their focus on scalable, performant APIs. The frontend teams can focus on accessibility, consistency, etc. I've fou…

it looks no different with ssr apps, and you don't have to give up any of what you mentioned at the beginning

Re: Ask HN: What companies are embracing “HTML over the wire”?

#80
I think I get it. You really don't want to shift your mind to the browser. Your mind is in the server, you know what's up in there, and distributed systems are complicated, so one of the ends should be made as dumb as possible. I get it.

Except, guess where the mind of the user is? On the other side of the browser. Embrace the browser, server people, it's closer to the user!

Post reply on HN