Skip to main content
100%

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 description

Demo PKG binary to serve html content

Steps to test

  • Execute ./retrieve.sh
  • Install pkg with npm i -g pkg
  • npm run build to build binary
  • click on the binary if through GUI otherwise , via a command line, do either ./server-static-offline-linux, ./server-static-offline-macos or server-static-offline-win.exe depending of your OS.
  • open a browser at http://localhost:8081/ to see local website
ISC Licensed

Similar vizzes