Leiningen and running Ring / Jetty on the fly

That damn Leiningen et al breaks with the past all the time, the docs at the page of the run plugin are already out of date.

It now seems you are required to have a -main function like so:

(defn boot []
  (run-jetty (var app) {:port 8090}))

(defn -main [& args]

And to then start your Jetty web server and tie it off nicely you can run the following line:

lein run -m name.space >> /dev/null 2>&1 &

When you finally do find the correct information and figure out how to do things the above way seems to be the easiest way to get a standalone Clojure web server up and running outside of the repl.

Related Posts

Tags: , , ,