tl;dr Use Nasus to serve static files quickly and easily.

There are any number of tools to serve up a single directory. I’ve long been partial to python -m SimpleHTTPServer because it’s available by default on macOS. (Though with the recent deprecation of scripting languages in Catalina, who knows how long that will remain true?) Since I’m partial to Clojure, I’ve become a fan of a Clojure implementation of this useful tool category: Nasus.

Used in tandem with tools.deps, serving up files is a simple one-liner:

clj -Sdeps '{:deps {nasus {:mvn/version "RELEASE"}}}' -m http.server

Though I like to add an alias to my ~/.clojure/deps.edn:

    :nasus {:deps {:mvn/version "RELEASE"}
            :main-opts ["-m" "http.server"]}

And now it’s as simple as:

clj -A:nasus

By default Nasus listens on port 8000, but that’s easy enough to change:

clj -A:nasus 3000

Questions? Comments? Contact me!

Tools Used

Clojure CLI