static.sh 526 B

12345678910111213
  1. #!/usr/bin/env bash
  2. # ZCode Sites start.sh for a static site. Copy static-server.mjs next to this file.
  3. # Runs in the foreground on 0.0.0.0:3000 (the runtime ignores the shebang and runs `bash start.sh`).
  4. set -euo pipefail
  5. cd "$(dirname "${BASH_SOURCE[0]}")"
  6. # ADJUST: directory holding index.html, relative to this file.
  7. SITE_DIR=dist
  8. # ADJUST: 1 for single-page apps (unknown paths fall back to index.html), 0 for multi-page sites.
  9. export SPA_FALLBACK=1
  10. export PORT="${PORT:-3000}"
  11. exec node static-server.mjs "$SITE_DIR"