On Thu, Sep 9, 2010 at 10:07 AM, Mike Meyer <
mwm-keyword-googlegroups.620...@mired.org> wrote:

> So, I'm asking for someone to show me I'm wrong. In particular, if I
> wanted to deploy a simple web app (the classic "Hello World") on your
> favorite java or clojure web framework, how many lines of text do I
> have to deal with?  Most importantly, how many of those are program
> text, and how many are framework boilerplate(*)? Finally, how many
> tools do I have to use to get it deployed(+)?
>

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

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

    (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:

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

So 12 lines of code and 2 command line operations, 1 expression at the REPL.

Cheers,
David

-- 
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