Hi @HannahLS!
Another interesting idea, which I have been playing with but not gotten to work quite yet, is a bit like Electron, but perhaps smaller and currently also a bit less user-friendly.
The idea is to distribute a compiled simple web server, along with the documentation. So:
windows_localhost.exe
mac_localhost.
linux_localhost
documentation/
index.html
app.js
data.json
media/
story.wav
So that would be put into a localhost_documentation.zip
or something like that, and then you’d unzip it, and click the appropriate executable depending on your laptop.
The localhost executable is just an HTTP server – when you double click it, it should run a webserver accessible at localhost:1234
or something like that. A bit odd at first, but you do see a web page, and something like the Moro project would run as-is.
I’m using the very basic file_server, which can serve an HTTP web site:
https://deno.land/std@0.137.0/http
This bit:
deno run --allow-net --allow-read https://deno.land/std/http/file_server.ts
> HTTP server listening on http://localhost:4507/
The executables are built with deno’s compile
function and the --target
flag, like this:
$ deno compile --output localhost_linux --target x86_64-unknown-linux-gnu --allow-net --allow-read https://deno.land/std/http/file_server.ts
$ deno compile --output localhost_windows --target x86_64-pc-windows-msvc --allow-net --allow-read https://deno.land/std/http/file_server.ts
$ deno compile --output localhost_mac --target x86_64-apple-darwin --allow-net --allow-read https://deno.land/std/http/file_server.ts
I tried it on mac and there was a serious problem: if I compiled the server executable in /some/directory/localhost_mac
, and then moved that executable to somewhere else, for some reason it served files from my home directory. Definitely not good. But I’m sure it’s because I’m trying to do this at a quarter to 2.
For more savvy users, running an HTTP server is very easy in many languages:
php -S localhost:8000 # from the Moro project!
python3 -m http.server
deno run --allow-net --allow-read https://deno.land/std/http/file_server.ts # (this is Javascript)
Which would get around having to distribute a localhost executable, but it’s nerdier.