This is an example music player server which sends down (partial) views via React + HTMX.
- Page content swaps and requests via HTMX
- Server-side templating via React
- Routing/middleware via Express.js
- Server run using Node.js
Type checking is provided via TypeScript + JSDoc annotations. No build step is required to run the server (after dependencies are installed).
- You will need to have Node.js 20 LTS (or newer) installed on your machine. You can download Node.js from the official website.
- After installing Node.js, you'll have access to the
npmpackage manager for installing the other dependencies.
Download the source code and install dependencies using the following commands. Run them one at a time.
git clone https://github.com/lanceturbes/simple-node-react-htmx.git
cd simple-node-react-htmx
npm installTo add music to the server, simply copy/paste your .mp3 files into public/music. Please name your files in
kebab-case, and avoid special characters in the file name.
After installing, you can use the following command to run the server:
npm startThis will launch the server on http://localhost:5000 (if you want, you can change the port variable
inside src/main.js).
- MIT License. See
LICENSE.md