Show HN: Full-stack _hyperscript Node.js TODO web app (with Htmx) (github.com)
Hey HN! I think _hyperscript is an insanely cool language, and while designed for simple front-end DOM interactions, I thought it would be a cool back-end scripting language as well. So, I slapped together a TODO app with a _hyperscript bootstrapping script based on the original repository's node-hyperscript example.
My repo isn't clean, just something I worked out over a weekend to prove the concept, also an excuse to play with htmx. :)
Please read the README, and let me know how, if anyone's interested, I can work in some of my tweaks to the original repository. I'm kind of a noob with open source stuff.
7 comments
[ 5.3 ms ] story [ 32.0 ms ] threadI literally built an entire app on it using PHP that feels faster and smoother than the same thing written in React, especially on a low-end device.
you can say
or or "the" is white space in the language (allowed before any expression) and helps w/ readability (according to taste)The first form is what I would recommend in most cases.
The second form is useful when you want to either highlight the property being set or when you want to tweak how the property binds (e.g. to avoid parenthesizing)
The third form is just there because JavaScript, but it works :)
glad you are enjoying the language!
https://htmx.org/discord
there is a hyperscript channel
the hyperscript parser is definitely idiosyncratic (i joke that i did the opposite of everything my compilers professor taught me) but once you see the patterns it isn't too bad
First, there was no duplication of validation, or business logic on forms between the front end and back end. Everything was written in one language (with the exception of HTML + CSS).
Second, the ability to send updates out-of-band was amazing. A user selecting a change on a form and updating a preview felt instant when compared to the same thing in React.
Third, no crazy hooks or weird keeping state between the view and the data we sent. We just used plain html and inputs to store the state along with CSRF tokens.
My only issue was that the browser didn’t validate the form before submission. So email inputs weren’t validated. I don’t know if that’s an htmx bug or expected behavior, but it was annoying.
https://htmx.org/attributes/hx-validate/