Getting startedwith noir-clojureexchange-2011

1,385 views

Published on

Really simple guide to Noir, a web framework written in Clojure. Get going with Noir in minutes.

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,385
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
12
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Getting startedwith noir-clojureexchange-2011

  1. 1. Thereally frakking simple guide to (Noir) - or how I learned to stop worrying about MVC and love the (function)
  2. 2. @jr0cket john.jr0cket.co.ukclojure.jr0cket.co.uk
  3. 3. Clojure.jr0cket.co.uk
  4. 4. Why use NoirFunctional programming web framework Simplicity over design patters Micro framework built on others
  5. 5. Functional for the webBig blog of stuff in > Big blob of stuff outEncourages modularising responsibilitiesGood at processing data in parallel
  6. 6. What does Noir look like?
  7. 7. Noir uses other components
  8. 8. Hiccup [hiccup "0.3.7"] Representing HTML in Clojure. It uses ● vectors to represent tags ● maps to represent a tags attributesuser=> (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>"
  9. 9. RingModular web applications applications, web servers, and web frameworks.
  10. 10. CompojureMaps requests to handlers (defpage "/" [ ] "hello")
  11. 11. Getting Started
  12. 12. Downloadwebnoir.org RequirementsOr via build tool Java 5 Leiningen Java 6 (better performance) Cake
  13. 13. Leiningen Build toolGet Leiningen (Line – ing – en): github.com/technomancy/leiningen leinTesing Leiningen lein repl
  14. 14. Leiningen REPL in action
  15. 15. Use the Leiningen Noir plugin you mustlein plugin install lein-noir 1.2.1 For easy project creation, use lein noir plugin you must
  16. 16. My first Noir project
  17. 17. Create a new Noir projectlein noir new my-website Choose wisely your website name, you must!
  18. 18. Running your websitelein runlein repl (server/start 3000) Modify your server dynamically you should, Using lein repl you must! Choose your port wisely young jedi
  19. 19. Noir project definitionproject.clj
  20. 20. Noir server definitionserver.clj
  21. 21. Noir server definitionView/welcome.clj
  22. 22. Noir View common definitionsview/common.clj
  23. 23. Simple todo list
  24. 24. Simple todo list - Output
  25. 25. Using forms
  26. 26. A bigger example
  27. 27. All hail ...An interactive shell for clojureExperiment with clojure in a safe andeasy way
  28. 28. Try Clojure - project.clj
  29. 29. Try Clojure - core.clj
  30. 30. Try Clojure lists - core.clj
  31. 31. Try Clojure text – core.clj
  32. 32. Try Clojure – CSS & JS – core.clj
  33. 33. Getting Data
  34. 34. Where to find out more
  35. 35. Where to find out more... http://webnoir.org/https://github.com/ibdknox/noir
  36. 36. Where to find out more... Extreme Startup WorkshopUse Noir to build your productand compete against others
  37. 37. Thank youNo (parentheses) were harmed in the making of this presentation.... @jr0cket john.jr0cket.co.uk clojure.jr0cket.co.uk

×