The
really frakking
 simple guide
   to (Noir)
 - or how I learned to
 stop worrying about
   MVC and love the
       (function)
@jr0cket

   john.jr0cket.co.uk
clojure.jr0cket.co.uk
Clojure.jr0cket.co.uk
Why use Noir
Functional programming web framework

    Simplicity over design patters

   Micro framework built on others
Functional for the web
Big blog of stuff in > Big blob of stuff out


Encourages modularising responsibilities


Good at processing data in parallel
What does Noir look
       like?
Noir uses other components
Hiccup [hiccup "0.3.7"]
      Representing HTML in Clojure. It uses
       ●   vectors to represent tags
       ●   maps to represent a tag's attributes

user=> (use 'hiccup.core)
                                         user=> (html [:div#foo.bar.baz "bang"])

                                         "<div id="foo" class="bar baz">bang</div>"


user=> (html [:span {:class "foo"} "bar"])

"<span class="foo">bar</span>"             user=> (html [:ul
                                                      (for [x (range 1 4)]
                                                        [:li x])])

                                             "<ul><li>1</li><li>2</li><li>3</li></ul>"
Ring
Modular web applications
  applications, web servers, and web frameworks.
Compojure
Maps requests to handlers
  (defpage "/" [ ] "hello")
Getting Started
Download

webnoir.org
                     Requirements
Or via build tool
                       Java 5
  Leiningen
                       Java 6 (better performance)
  Cake
Leiningen Build tool
Get Leiningen (Line – ing – en):

  github.com/technomancy/leiningen
  lein

Tesing Leiningen

  lein repl
Leiningen REPL in action
Use the Leiningen Noir plugin you
              must

lein plugin install lein-noir 1.2.1




           For easy project creation, use
           lein noir plugin you must
My first Noir project
Create a new Noir project



lein noir new my-website



       Choose wisely your website name, you must!
Running your website

lein run

lein repl
  (server/start 3000)

     Modify your server dynamically you should,

     Using lein repl you must!

     Choose your port wisely young jedi
Noir project definition

project.clj
Noir server definition

server.clj
Noir server definition

View/welcome.clj
Noir View common definitions

view/common.clj
Simple todo list
Simple todo list - Output
Using forms
A bigger example
All hail ...




An interactive shell for clojure

Experiment with clojure in a safe and
easy way
Try Clojure - project.clj
Try Clojure - core.clj
Try Clojure lists - core.clj
Try Clojure text – core.clj
Try Clojure – CSS & JS – core.clj
Getting Data
Where to find out
     more
Where to find out more...


      http://webnoir.org/

https://github.com/ibdknox/noir
Where to find out more...



  Extreme Startup
     Workshop
Use Noir to build your product
and compete against others
Thank you
No (parentheses) were harmed
     in the making of this
        presentation....

                  @jr0cket
    john.jr0cket.co.uk
 clojure.jr0cket.co.uk
Getting startedwith noir-clojureexchange-2011
Getting startedwith noir-clojureexchange-2011
Getting startedwith noir-clojureexchange-2011

Getting startedwith noir-clojureexchange-2011