6 ms·
Cool project! Setting up a quick local HTML server can be annoying. Alas it looks like it's web/electron based. :/ Downloading it and yep, 443.8 MB on MacOS. T
by elcritch 2y ago
Cool project! Setting up a quick local HTML server can be annoying.
Alas it looks like it's web/electron based. :/ Downloading it and yep, 443.8 MB on MacOS. The Linux one is a bit better at 183.3 MB.
Electron really should get a kickback from disk manufacturers! ;)
Shameless plug, I've been working on a HTML inspired lightweight UI toolkit because I'm convinced we can make these sort of apps and they should only be ~10-20 MB [1] with nice syntax, animation, theming, etc. I'm finally making a suite of widgets. Maybe I can make a basic clone of this! Bet I could get in < 10MB. :)
1: https://github.com/elcritch/figuro https://github.com/elcritch/figuro
- tredre3 2y agoFiguro is like Sciter but for Nim?
- elcritch 2y agoSorta! It didn’t start out that way but I’ve been building more from HTML overtime but keeping it fast and lightweight. I’ve cherry picked a subset of HTML like CSS grids which add a lot of layout power without tons of normal HTML hacks. I want to try adding a JavaScript runtime with simple DOM built on Figuro nodes instead. But there’s some issues with Nim’s memory management and QuickJs.
- cosmotic 2y agoFunny the bulk of the server is vestigial client code.
- elcritch 2y agoFigures, though I suspect that code only makes up a fraction of the binary size. Assuming it’s electron most of that bulk is chromium bits.
- tyzoid 2y agoMy usual go-to for a quick static server is: python -m http.server But variations exist for a lot of languages. Php has one built-in too
- zikduruqe 2y agoDon't forget bash. #!/bin/bash while :; do nc -l 80 < index.html; done
- xmodem 2y agoI was about to down-vote you, but that would be unfair, as this has roughly the typical level of correctness of most bash scripts.
- rollcat 2y agoIt's absolutely (almost) correct! HTTP/0.9 does not require you to send back a status code or any headers. Some modern web servers even recognise a lone "GET /" to mean HTTP/0.9 and will respond accordingly.
- xmodem 2y agoThis is exactly my point - it successfully accomplishes a very specific task, in a way that is fragile and context dependent, and completely fails to handle any errors or edge cases, or reckon with any complexity at all.
- vFunct 2y agoThis is hilarious
- creatonez 2y agoFor anyone baffled by this: This works because HTTP/0.9 (just called "HTTP" at the time) worked in an extremely simple way, and browsers mostly retained compatibility for this. HTTP/0.9 web browser sends: GET / Netcat sends: <!doctype html> ... Nowadays a browser will send `GET / HTTP/1.1` and then a bunch of headers, which a true HTTP/0.9 server may be able to filter out and ignore, but of course this script will just send the document and the browser will still assume it's a legacy server.
- blacksmith_tb 2y ago
- 1vuio0pswjnm7 2y ago"Bet I could get in < 10MB." I use one that is 99K static binary. Even the full-featured TLS/HTTPS forward proxy I use, linked with bloated OpenSSL, is still less than 10MB static binary: 8.7MB. When linked to WolfSSL it's only 4.6MB static binary. The proxy can serve small, static HTML pages, preloading them into memory at startup.
- elcritch 2y agoFor a GUI app though?
- sgarland 2y agoWinRAR is 3.7 MB.
- 1vuio0pswjnm7 2y agohttps://codeload.github.com/openwrt/uhttpd/zip/refs/heads/master https://codeload.github.com/openwrt/uhttpd/zip/refs/heads/ma...
- shakna 2y agoRandom tangent: It appears that most of Electron's funding is actually the German government. The Sovereign Tech Agency, under the Federal Ministry for Economic Affairs and Climate Action, fund OpenJS, specifically for improving the state of open source in JavaScript. Electron is now part of OpenJS.
- Y_Y 2y agoIs wasting cycles considered "climate action" now?
- lmz 2y agoIt's an action alright. The direction, however...
- netsharc 2y agoI wonder if I can get an LLM to act as a webserver, and connect it to a TCP port...
- genewitch 2y agoYes, just say "format your responses as a web server" and then connect it to netcat. I thought everyone tried this? It speaks HTML, and tossing in the few things the spec requires is peanuts to an llm.
- 8-prime 2y agoI like and understand the paradigm of using web technologies to build GUI apps. I have yet to find any desktop framework that even comes close to the DX of using web tech. I recently explored both Tauri [1] and Wails [2]. Especially Wails is lots of fun. The simplicity of go paired with the fast iteration I get from using React just feels awesome. And the final application is ~10 MB in size! [1] https://v2.tauri.app/ https://v2.tauri.app/ [2] https://wails.io/ https://wails.io/
- onli 2y agoDid you try Flutter? That one worked for me at least as well as using the web approach. Definitely from a DX side.
- 8-prime 2y agoI have tried Flutter and liked it for mobile development. Maybe I should give it a shot for desktop. Though I believe those that dislike Electron and the likes for not being native would also have a bone to pick with Flutter.
- brulard 2y agoWith flutter you give up all the standard web components, accessibility defaults etc. If you don't mind, then it's definitely an option.
- fake-name 2y agoOTOH, I have yet to see any web framework that comes even close to the UX of native tech. It's almost as if web crap is optimizing for developer experience at the expense of users.
- chabska 2y agoCould you list out your native GUI stack, for Windows, OSX and Linux?
- 2y ago
- thomas-mc-work 2y ago> Alas it looks like it's web/electron based. For me this contradicts the claim of being simple. As opposed to this: python -m http.server 8080
- drcongo 2y agoI use miniserve (< 5mb) just because I can never remember the python incantation. https://github.com/svenstaro/miniserve https://github.com/svenstaro/miniserve
- nickpsecurity 2y agolighttpd is awesome for a quick, local server on Ubuntu. One command installs it. You tell the firewall to allow it. Then, just move your files into the directory. Use a CDN, like BunnyCDN, for HTTPS and caching. It's not only easy: it runs (or ran) huge sites in production.