1. 4

  2. 13

    But the whole value of SimpleHTTPServer is its ubiquity.

    1. 2

      And if you need speed and are someone with go installed, you could write a one line main anyway:

      http.ListenAndServe(":80", http.FileServer(http.Dir(".")))

      1. 3

        In that case I can just run an nginx though.

        1. 2

          That’s absolutely true. I would run nginx or a one line main before I would clone a repo, build it, and so on.

          1. 5

            If you have the go toolchain installed, this is a single ‘go get’ and you have it in your path forever. I found it particularly useful for looking at python coverage results on a headless machine. SimpleHTTPServer simply couldn’t serve the page as it had too many subcomponents; serve-dir served it up in milliseconds. nginx requires writing a config, setting it up as a daemon, and likely running via sudo (or figuring out some way to redirect the logging to non-root locations).

            1. 1

              All my bet is that native http.FileServer of golang is cache aware which is not the case of SimpleHTTPServer

            2. 2
          2. 2

            It was simply faster for me to code one than find one on the interwebs.

            It seems he agrees :)

            1. 2

              What’s funny is I found that line on the interwebs, it used to be an example on the net/http godoc.

        2. 1

          I use http-server for this purpose. You install it with npm (Node) instead of go. It’s just as simple: http-server or http-server --help.