Re:Htmx 2.0.0 has been released
by unsupp0rted on Tuesday June 18, 2024 @07:15AM
(#40716374)
Isn’t that moving code around, not deleting it?
[ Parent
| on HN ]
Most likely that code already existed server-side and was duplicated client-side. It's what usually happens since frontend code can't enforce invariants.
Re:Htmx 2.0.0 has been released
by simonbarker87 on Tuesday June 18, 2024 @10:15AM
(#40718128)
Near enough exactly this
Could you elaborate on what you mean by "frontend code can't enforce invariants" ?
Frontend code can be easily bypassed or changed so you can't trust it to keep the state of your application in good condition. Nothing prevents me from picking the same username as someone else if there is no server-side code stopping it. Nothing prevents me from replying to a deleted comment if I don't check with the server.
That means that any validation that you do client-side you need to repeat server-side. Any business logic that you have client-side you also need to repeat server-side.