Demo PKG binary to serve html content
✓ Published0🌍 Public
TThomasG77
Last edited Sep 30, 2021
Created on Sep 30, 2021
This example demonstrates how to package a static website into a standalone executable binary using the `pkg` tool. The code uses Express to serve the contents of a `dist` folder, which it retrieves by downloading and unzipping the `doc.data.gouv.fr` GitHub Pages repository via a shell script. After building the binary with `npm run build`, the user can launch it on any OS and access the site at `http://localhost:8081/`. The visualization highlights the workflow of converting web content into a portable, offline server application.
AI-generated descriptionDemo PKG binary to serve html content
Steps to test
- Execute
./retrieve.sh - Install pkg with
npm i -g pkg npm run buildto build binary- click on the binary if through GUI otherwise , via a command line, do either
./server-static-offline-linux,./server-static-offline-macosorserver-static-offline-win.exedepending of your OS. - open a browser at http://localhost:8081/ to see local website
ISC Licensed