☝️ This is Squigil.
And 👇 this is the repo for ...
... which is a framework (?) for hosting and live editing pages and scripts on Fastly Compute.
The house follows a few simple rules:
- The stuff rule: the house's pages, scripts, and other files are, collectively, its "stuff."
The house keeps its stuff in a KV store under a path-like key, which looks like
a/a/index.js. - The separator rule: the string
/~/is a special "separator" in the request URL path. To serve a request with the URL path/a/a/~/b/b, the house runs the entrance scripta/a/index.jsfrom its stuff with/b/bas the "inner path" argument. - The implicit separator rule: a request URL path without the separator in it implicitly has it at the beginning.
The request URL path
/b/bis equivalent to/~/b/b, which runs the entrance scriptindex.jswith/b/bas the inner path argument. - The entrance rule: an "entrance" script starts with the string
// ~ //. - The root rule: the entrance script
index.jsis the "root" entrance script, which acts like a static file server. When the house runs it with the inner path argument/b/b, it returns the filepublic/b/bfrom the house's stuff. - The root index rule: the root entrance script serves an
index.htmlpage when the inner path has a trailing/. When the house runs it with the inner path argument/b/c/, it returns the pagepublic/b/c/index.htmlfrom the house's stuff. - The admin rule: the entrance script
admin/index.jsis the "admin" entrance script, which runs arbitrary code for an authorized user.
To build and run Squigil's house in the local development environment, type the following command:
npm run startTo build and deploy Squigil's house to your Fastly account, type the following command. The first time you deploy the application, you will be prompted to create a new service in your account.
npm run deploy