Nell’s post about their IFComp remasters (“Games no longer require a live server to run, so they may be downloaded and played offline!”) reminded me that a week or two ago I threw together a local web server that’s a single .exe that you can drop a folder or HTML file on and it’ll start a server AND open the page/site in your default browser.
Kind of a silly little thing (under 100 lines of Go code, builds to about an 8MB binary), but I’ve been enjoying having it on my desktop: even though I use the command-line all the time, this is remarkably convenient.
The code should theoretically build for Mac too but I was too lazy to pull out the hardware and do it…but I included the source file in the zip in case you’re a Mac user who has the Go programming language installed and wants to try go build localserver.go – it might well just work? Dunno. Go seems pretty solid.
I tried it on my web games and it works nicely. Which is a good test because i need something not completely dumb to serve my HTML. I use HEAD and GET ranges to stream audio and video and these work here. Excellent!
My only complaint is that it weighs in rather large at 8MB. Currently, i use civetweb as a standalone web server, which by comparison is only 350k.
lol, I grabbed Go because it made pretty small executables: I poked at a couple other programming languages with similarly “just drop in a static web server” packages and they were weighing in more like 40-50MB.
Also I’m sort of assuming that most games that need a server are going to include images or sounds/music, which are going to outweigh 8MB pretty quickly.
Yeah, obviously you can go a lot smaller if you go to C++ or something. Might it be possible to build yourself a modified civetweb that execs cmd.exe /c start [url] or whatever?
But for only wanting to spend a couple hours making it, I’m pretty happy with 8MB.
Oh nice, almost 30% smaller with -s. I never know if stripping binaries is going to do much of anything: IIRC it’s pretty marginal with Rust executables.
…and I do have a Mint machine and yeah, it looks like the linux cross-compiled version works just fine there. I’ll have to upload those too.