logoalt Hacker News

naaskinglast Thursday at 3:37 PM2 repliesview on HN

> Frontend and backend must agree on every scenario

When is this not the case?


Replies

wrslast Thursday at 5:23 PM

I suspect the hidden assumption here is that frontend and backend are written by different people/teams with a narrow interface between them. Because they use different technologies and build tools it’s easy for them to end up being competely siloed, which IMO is one of the worst aspects of how webdev evolved in the last 20 years.

Thus, it’s considered normal that the backend team spits out some JSON and doesn’t know or care what the frontend team does with it.

With HTMX that distinction doesn’t exist so much (the frontend consists of fragments generated by the backend) so you will need a different organizational approach. The “frontend” folks will need to write a lot of “backend” code, but presumably in a separable layer.

show 1 reply
samtheprogramlast Thursday at 3:42 PM

When an API returns JSON, your JS framework can decide what to do with it. If its returning HTML that's intended to go in a particular place on a page, the front-end has far less flexibility and pretty much has to put it in a specific place. Hence why they said endpoints can return 3-5 different versions of HTML.

show 2 replies