https://htmx.org logo
Join Discord
Powered by
# node-htmx
  • s

    shy-zebra-22292

    11/30/2022, 5:12 PM
    Still, thanks for the kind word. You're free to feel illuminated 😁🤣
  • b

    brainy-ice-92385

    11/30/2022, 6:52 PM
    I'm so happy to have started this conversation 😄 the ADR thing is a fantastic idea. I might add it as an addendum to my post with your consent
  • j

    jolly-kite-167

    11/30/2022, 6:55 PM
    certainly
  • a

    adventurous-salesmen-25637

    12/01/2022, 1:35 AM
    I've been playing with JSX as as server side templating language...I managed to set up automatic nested routes/layouts which might be interesting: https://cloudflare-pages-htmx.pages.dev/bookings https://github.com/patdx/worker-experiments/tree/main/packages/cloudflare-pages-htmx
  • a

    acoustic-autumn-94211

    12/01/2022, 3:24 PM
    nice! will take a look at this - I've been tinkering with cloudflare as well - another option is Hono which now supports JSX: https://honojs.dev/docs/builtin-middleware/jsx/ it's pretty slick, although I have missed file-based routing
  • a

    adventurous-salesmen-25637

    12/01/2022, 7:18 PM
    Thanks. Hono and their JSX looks quite cool and much more production ready than my experiment. ☺️ One big difference is Hono’s JSX is just a JSX to string generator, I think no support for hooks/context/etc. In my experiment I’m more interested in seeing if I can “compile” some pages into htmx syntax automatically..For example: it is using React Router v6.4 and context on the server side as a way to automatically assign IDs at layout boundaries here: https://github.com/patdx/worker-experiments/blob/main/packages/cloudflare-pages-htmx/lib/htmx-outlet.tsx Later on, when navigating between pages the server only renders the content inside that changed layout boundary and tells htmx to swap out the content of it by referring to the (automatically generated) ID of the boundary. But the only JS loaded in the browser is still just htmx, no React.
  • b

    boundless-vase-80440

    12/12/2022, 5:25 PM
    Hi, are there any htmx middleware for express like the one for django?
  • r

    refined-waiter-90422

    12/12/2022, 5:38 PM
    Someone will probably chime in, but fyi, there's really not much to "htmx middleware". Just checking a header value to see if the request is from htmx, and extra htmx header params if you need em.
  • r

    refined-waiter-90422

    12/12/2022, 5:39 PM
    a popular pattern is if you know it's from htmx, you can render a partial template instead of a full template.
  • r

    refined-waiter-90422

    12/12/2022, 5:42 PM
    but yeah you're not missing out on much
  • b

    boundless-vase-80440

    12/12/2022, 5:44 PM
    Thanks for your answer! I was looking at django-htmx and yes, its middleware mostly deals with the custom headers. Is it my "think-big-brain" side talking if I have the urge to create a similar thing for express?
  • m

    mysterious-toddler-20573

    12/12/2022, 5:54 PM
    no
  • s

    some-airline-73512

    12/23/2022, 10:12 PM
    Anyone uses typesafe template engine? I'm looking for something like Nunjucks but typesafe
  • s

    some-airline-73512

    12/23/2022, 10:19 PM
    I'm thinking ES6 template strings might work as well. Anyone used them?
  • b

    brainy-ice-92385

    12/24/2022, 6:41 AM
    I use JSX with React and it works great!
  • s

    some-airline-73512

    12/24/2022, 12:22 PM
    Is JSX statically compiled? Maybe I could use it without React...
  • b

    brainy-ice-92385

    12/24/2022, 10:07 PM
    JSX gets transpiled to JS. You can definitely use it without React but I find no reason to. I only use React to compile the JSX and render the HTML, I don't use it on the front-end (React isn't even loaded in the browser). I wrote about it a little here https://reeds.website/blog/20220923-my-fresh-website/
  • s

    some-airline-73512

    12/25/2022, 3:44 PM
    Thanks, I will read for sure
  • s

    some-airline-73512

    12/25/2022, 3:46 PM
    I’m also thinking of using https://djc.github.io/askama/ It’s Nunjucks written in Rust. So it had native speed. I think it makes sense to have high performance rendering on the server, so that every click for a user feels faster. From my observations rendering usually takes a huge portion of the entire request pipeline. Sometimes it’s 80% of the whole latency budget.
  • i

    important-cricket-63511

    12/30/2022, 6:16 PM
    Any recommendations for NodeJS websocket libraries?
  • o

    orange-umbrella-16693

    12/30/2022, 9:00 PM
    default
    ws
    , if you want nice express integration there's
    express-ws
    I think it was called, basically the ws package but written nicely around express if you want speed there's uWebSockets and probably some wrapper for it, if not you can look at how socket.io implements it
  • b

    boundless-vase-80440

    01/02/2023, 5:48 PM
    +1 for ws and express-ws
  • l

    limited-teacher-83117

    02/17/2023, 6:09 PM
    I don't quite have the receipts to share yet, but I've been building a few useful webapps (including one with a few thousand requests a day that used to be React-based) with just
    express
    and
    nunjucks
    and have found the experience to be very pleasant
  • l

    limited-teacher-83117

    02/17/2023, 6:10 PM
    I think that
    express
    is way too heavy a dependency, and
    nunjucks
    syntax is kind of gross + no template fragments so there's lots of room improvement, but it's a very good way to get started on the hypermedia philosophy
  • l

    limited-teacher-83117

    02/22/2023, 2:19 PM
    See also #1077726886551109692
  • l

    limited-teacher-83117

    02/22/2023, 2:19 PM
    node developers show yourself!!
  • f

    fresh-midnight-60146

    03/24/2023, 5:16 PM
    Hey hey everyone! I hope y’all are doing well. I was wondering if I could connect with someone who is familiar with using HTMX along with MongoDB, mongoose/express. I’m building a simple CRUD app but I’m running into an issue where the update and delete routes aren’t working out…I’m essentially new to backend development so I’m needing just a little bit of guidance. If someone would like to help, I’d like to connect and message you. Thanks!
  • l

    limited-teacher-83117

    03/25/2023, 9:20 PM
    Looks like you got help in the main channel but if you into any other node issues definitely feel free to post them here
  • g

    gorgeous-airport-54386

    05/16/2023, 11:16 PM
    `npm i
    <:npmx:1108170106246266960>
    .org`
  • l

    limited-teacher-83117

    05/19/2023, 2:25 PM
    ^ that's actually how I deploy it on node, with a long cache time:
    Copy code
    js
    app.use(
      `/htmx-${HTMX_VERSION}`, 
      express.static('node_modules/htmx.org/dist')
    )