esmiralha / express-htmx

Extensions for using htmx with Express.
2 stars 0 forks source link

express-htmx

Extensions for using htmx with Express.

Installation

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

npm i --save express-htmx

How to use

The htmx module contains two sub-modules:

const express = require("express");
const htmx = require("express-htmx");

const app = express();

app.use(htmx.middleware);

app.get("/", function (req, res) {
  if (req.isHtmx()) {
    // serve partial
  } else {
    // serve full page
  }
});