asljs-server
v0.2.3
Published
A lightweight development-time static files server. Supports live-reload. Provides filesystem read-write API.
Maintainers
Readme
asljs-server
A lightweight development-time static files server with live-reload (SSE) and a filesystem read/write API.
CLI
After installing:
asljs-server
Or without installing:
npx asljs-server
Examples
Serve current folder on port 3000:
asljs-server
Serve a specific folder:
asljs-server ./publicasljs-server --root ./public
Change port/host:
asljs-server --port 8080asljs-server --host 0.0.0.0 --port 8080
Map a folder under a virtual path:
asljs-server --mount assets=../Assets- Serves
../Assets/logo.pngas/assets/logo.png
File API
GET /api/file?path=pathreturns the file contentsPUT|POST /api/file?path=pathwrites the fileGET /api/files?path=pathlists all files in the directory
Folder mappings apply to the File API too. For example, with --mount assets=../Assets:
GET /api/file?path=assets/logo.png
Live reload
HTML pages get a small client injected that listens on:
GET /__events
