Live server
Settings of the project's live server: the port and the allow list of actions that pages may run. How to start the server and how to make your own interactive page.
The live server opens a project in a browser so that lenses and your own HTML pages can change records: move cards, change fields and text, create records, run allowed actions. The server works only on this computer.
Starting
shtuk run live serve # the port from this page
shtuk run live serve --port 4400
The server prints two links. The link with ?token=… turns on editing: the browser remembers the session token in a cookie. The link without a token is read-only. A new start is a new token. To stop, press Ctrl-C.
Open lenses update themselves: the server watches the project's files, rebuilds the lens data after an edit and tells the pages to re-read it.
Settings
The fields in the header of this page:
| Field | What it means | Default |
|---|---|---|
port | the server port | 4322 |
run | the allow list of actions: lines "package action", for example lenses build; shtuk check is all the project's checks | empty: pages run nothing |
host | the address; only 127.0.0.1, localhost, ::1 are allowed | 127.0.0.1 |
The token cannot be turned off. Norms: LIVE-R01 (only this computer), LIVE-R02 (writing by token), LIVE-R03 (the allow list).
Your own interactive page
shtuk run live appplaces the example, a task board with the buttons "Take", "Done" and "Check project", inwork/tasks-app.html. For another place:shtuk run live app <path.html>.- For the "Check project" button to work, add
shtuk checktorun:of this page. - Open the page by the server's link with the token and edit it like ordinary HTML: the buttons call the server's API through
fetch.
What the API can do, with examples, is on the package page: .shtukbase/packages/live/package.md.
/base/live.md.Source text