read


read
or learn more

Announcing: lein-simpleton

Apr 9, 2013

At various times I’ve needed something very similar to python -m SimpleHTTPServer <port> readily accessible in my Clojure projects. Most of the time I just used Python but recently I’ve wanted to rework some examples from The Joy of Clojure and thought a simple Lein plugin would make a nice addition. The result: lein-simpleton — I hope you’ll find it useful.

Usage

See the lein-simpleton project page for installation instructions for the latest version.

Running

By default Simpleton provides a file-server in the directory where it’s run. To run:

$ lein simpleton <port>

Navigate to localhost:<port> and see a directory listing. Click around to navigate directories and download (some) files.

Running the echo server

Simpleton can also run an echo server that reflects the incomming HTTP headers back as EDN data.

$ lein simpleton <port> echo

Navigating to localhost:<port> to download an EDN file.

Running the hello server

Simpleton can also run a “Hello” server that just returns a canned text string.

$ lein simpleton <port> hello

Navigating to localhost:<port> to see the message.

That’s all for now.

:F

8 Comments, Comment or Ping

  1. This is great news, and will go straight into my profiles.clj. I’ve long had an alias in my terminal for doing just that, but that means python becomes a dependency.

    Yay! Thank you!

  2. Couldn’t find project.clj, which is needed for simpleton Shutting down Simpleton…

    Am I doing something wrong?

  3. @Max

    Try the 1.0.1 version. I forgot some metadata needed by Leiningen.

  4. @fogus

    Updated plugin to 1.0.1 (just saw your commit), all works fine.

    Thank you for being awesome :)

  5. Igor

    Can’t access a file with spaces in its name. The output is like that:

    Starting file server on port 2000

    ./File%20With%20Spaces (No such file or directory)

  6. Igor

    Simpleton doesn’t have a help string. Instead, when I run “lein help” the last line of output is “Shutting down Simpleton…”

  7. @Igor the v1.0.2 version should fix the problems that you were experiencing.

  8. Igor

    Thanks! The most useful web server I ever used, seriously! (oh, and I just found out that it can’t handle files with \’ in their names…)

Reply to “Announcing: lein-simpleton”