Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
serve
serve starts a simple temporary static file server in your current directory and prints your IP address to share with colleagues (by philippgille)
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
While I love Go, have we gotten this lazy that we need a package for this? Go does this in 3 lines minimum, like you describe in your blogpost. However, in your package you expose the ability to kill your server [0] without any security. That’s a huge vulnerability. I know you’ll say “It’s just a static server, meant for serving static stuff” but it will be indexed by go.dev, people will use this outside your intent. It is the way.
[0] https://github.com/eliben/static-server/blob/3ce83524ed54298...
https://caddyserver.com/ is implemented in Go, production-ready, and easy to setup with a one-liner (though personally I would use official binaries or compile from source rather than use the builds from a distro package manager)
I wrote something like this [1] for the team at my old workplace. We mainly worked on static html files but some functionality required loading via http. Many of the devs were quite new to development in general, so I built a simple static server in Go, as an exe which they could set as the default for `.html` file, and therefore just open via the webserver via double-click as normal. The program would watch the directory (if not already open and watching) then open the right path in the default browser. I also built-in livereload, management via tray icon and a basic web UI.
[1] https://github.com/ssddanbrown/webby
There are many projects doing the exact same thing. Here's one approach from myself, but haven't updated since 2019:
https://github.com/philippgille/serve
One difference is that it can create a TLS cert for you, instead of having to supply one via CLI arg.
I don't recommend using it in its current form though due to its (the compiled binaries') Go version being outdated.
I, too, would like to see this, but it'll be a lot of work. It's just not a top priority right now for me, unfortunately.
This is something I could prioritize if a business wanted to sponsor this; but right now the most pressing things are updating the docs, revamping our test suite, and I have a few action items for existing sponsors I need to prioritize too.
Anyway, no timeline -- but definitely something wanted!
PS. There is kind of Caddyfile support here: https://github.com/RussellLuo/caddy-ext/tree/master/layer4