Ran: a simple static web server written in Go
github.com
github.com
python -m SimpleHTTPServer
works everywhere I need it to work.Anyway, kudos for making a Go project shipped, which I fail to accomplish for several months now ;-)
Which is not usually relevant if you just want to share a file over local HTTP. If you need a production-level HTTP server, you're not using either.
> it's certainly faster to type "ran" than "python -m SimpleHTTPServer".
If you're smart enough to compile ran and put it on your PATH, you're probably smart enough to create an alias for `python -m SimpleHTTPServer`.
It is faster to use an existing tool (python or another one) than rewriting a 2K LOC one. This is great for learning Go but the compounded time "lost" with a "slow" python server is nothing compared to the time this tool will require in development, debugging and maintenance over the years. As anyone else, I am subject to NIH and I can understand why writing one's own library is interesting by itself. Please don't invent weak excuses like "ran is faster to type".
I was helping run a programming workshop last week and I wrote my own tiny concurrent server in Go but in the future I think I'll just use Caddy (https://github.com/mholt/caddy).
python -m http.serverI took advantage of the cross os compilation and also provide prebuilt binaries for the various os's. Might be worthwhile doing.
I'll add a stub to the readme to see your project.
It would be great to have that functionality bundled into a single file executable, or rather three executables for Windows, Mac, Linux.
It also freaks out if the root dir is blown away, which can be quite common if you're trying to use it with a static site generator.
'python -m SimpleHTTPServer' is great for serving files to yourself but that's about it.
Gets the job done!
Very configurable but also very easy to get started.
$ caddy browse
and off you go.But I don't understand why the build script is written in Python? I think that either you should use a simple shell script or stick to Go.
Without, you know, having to write it, even if Go's libraries make it fairly easy to do so.
My go-to (haha) for this is Goserve[1]. I'm not sure why I'd switch to this, except that it may now have more eyes on it after today's publicity (it's already got more stars than Goserve—a little advertising goes a long way)
$ go get github.com/m3ng9i/ran && ranI use "python3 -m http.server" a lot when I'm just testing a bit of HTML/JS and don't want to setup a whole virtual host within Nginx/Apache. It just starts a static file server, on any platform.