I wrote something similar long ago in < 400 lines of Go (with most of it being templates and mimetype information) that just supports GET, HEAD and gzip, in case you're interested[4].
[1] https://caddyserver.com/docs/quick-starts/static-files
[2] https://www.npmjs.com/package/sirv-cli
[3] https://openwrt.org/docs/guide-user/services/webserver/http....
gzip is unnecessary because 99% of the traffic I would serve is going to be pre-compressed (like zip and jpeg files).
Redbean in general seems great and really interesting.
serve also comes to mind. If you have node installed, `npx serve .` does exactly that.
There are a few go projects that fit your description, none of them very popular, probably because they end up being a 100-line wrapper around http frameworks.
Minimality is not about size, it's about reducing the attack surface.
> There are a few go projects that fit your description, none of them very popular, probably because they end up being a 100-line wrapper around http frameworks.
Indeed. Everyone can write their own but dependencies will make its attack surface enormous and performance will probably be mediocre at best.
Here's[5] an example I put together that I have running on fly.io[6]. I'm doing a redirect for root path, but it could easily be changed to serve up the contents of index.html.
I use a similar deployment for a small site I created[7] to generate UUIDs. Kemal[8] also looks like a good alternative.
----
Update:
Here's[9] an example also running on fly.io[10] using Kemal[8]
[1] https://crystal-lang.org/api/1.11.2/HTTP/Server.html
[2] https://crystal-lang.org/reference/1.11/guides/static_linkin...
[3] https://docs.docker.com/build/building/multi-stage/
[4] https://hub.docker.com/_/scratch/
[5] https://github.com/adrianlv512/minimal-server
[6] https://minimal-server.fly.dev
[7] https://uuid-generator.org/
https://github.com/radiosilence/nano-web?tab=readme-ov-file#...
It's written in Go, has zero third party dependencies, supports optional basic auth, and optional TLS cert generation (self signed) for local HTTPS.
Not updated in a while though.
And if you drop the requirement for minimalism I'd second the recommendation for Caddy instead.
readme: http://canonical.org/~kragen/sw/dev3/httpdito-readme
source (single file): http://canonical.org/~kragen/sw/dev3/server.s
it might be reasonable to configure its port and mime types map on the command line instead of in the source, but at the moment it's arguably a bit too zero-configuration
it runs on linux, can handle about 20000 hits per second, has about 20 kilobytes of memory footprint when idle, and needs another 4 kilobytes per concurrently open connection (though the kernel needs several times that)
20000 hits per second is not really fast in the sense that other servers on the same hardware and kernel can handle more than twice that, but it can saturate a gigabit pipe if your files average 7 kilobytes or more