On Thu, 9 Sep 2010 10:59:28 -0400
David Nolen <dnolen.li...@gmail.com> wrote:

> If you're going for simplicity over robustness and you have lein installed,
> all you need to do is the following:
> 
>     lein new nano-web

Yup - the goal is simplicity. Robustness is important, but I expect
the web server to take care of that. What I'm really expecting to lose
here is performance.

> Edit your project.clj
> 
>     (defproject nano-web "1.0.0-SNAPSHOT"
>       :dependencies [[org.clojure/clojure "1.2.0"]
>                      [org.clojure/clojure-contrib "1.2.0"]
>                      [ring "0.2.5"]])
> 
> So far we have 4 lines to define our dependencies. Edit
> src/core/nano_web.clj

You mean src/nano_web/core.clj.

>     (ns nano-web.core
>       (use [ring.adapter.jetty :only [run-jetty]]
>            [ring.util.response :only [response]]))
> 
>     (defn hello-world [req]
>       (response "Hello World!"))
> 
>     (defonce server (run-jetty hello-world {:port 8080 :join? false}))
> 
> That's the 8 lines of actual code needed to have a full functioning web
> application. Let's start it:

The blank lines don't count, so it's six lines of code.

>     lein repl
>     user=> (load "nano_web/core")

And two tools - lein and clojure itself.

So we go from 3, 0, 1 to 6, 4, 2. I'm not sure that qualifies as
simple, but at least there's less boilerplate for the tools than there
is actual source code.

Thanks for the answer.

And, since I forgot, thanks to Meikel Brandmeyer for his earlier
answer as well.

       <mike
-- 
Mike Meyer <m...@mired.org>             http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to