4 ms·
> sort of like an Electron competitor How would this work? Does the user start and stop the server manually? One nice thing about an electron app is that you o
by haberman 4y ago
> sort of like an Electron competitor
How would this work? Does the user start and stop the server manually? One nice thing about an electron app is that you open and close it like a normal application.
- capableweb 4y agoHaven't used Redbean specifically for it, but built similar things with Rust, Clojure and Golang before. The way I used it was that if the user launched the binary, it spawned a server and opened the browser pointing at it. If the user closed the tab, it automatically shut down the server. Or if it lost connection to any browsers for more than one hour.
- Cthulhu_ 4y agoThat seems pretty clever, I think there's actually quite a few applications that work like that. And with binary servers, startup is pretty fast too.
- jart 4y agoOne way to do it is you'd create a `.init.lua` file in the zip with this: LaunchBrowser('/') That way when redbean starts up, it opens a tab in your desktop browser automatically to display your app. https://redbean.dev/#LaunchBrowser https://redbean.dev/#LaunchBrowser
- kencausey 4y agoIs there any possibility that this could be extended to be able to specify a preferred browser or ordered list of said? I ask this because part of my work involves accessing a large number of user computers and I've found that few users set their preferred browser, they will overlook the browser request to be the default for long periods of time or just dismiss it.
- jart 4y agoThis is a great example of something that can be built with the new unix module. It's unlikely we'd add a high-level API for this. The good news is you don't need us to do that since the unix module gives you all the power you need, and if it doesn't, please file an issue and we'll fix it.
- modeless 4y agoI did something like this before redbean. You can set it up so double clicking the app icon launches the server and opens the UI in a PWA window, not a browser tab. Then you can set it up so that the server exits when all application windows are closed.