Web ApplicationDevelopmentin ClojureJacekLaskowski @JacekLaskowskiblog.japila.plKiev, Ukraine, 24.05.2013
Map data structure in ClojureSymbol “m” points at the map
Map in Clojure• Map maps keys to values• Maps are functions of theirkeys• Keywords usually keys• assoc to add key and valu...
“Functional” requesthttp://localhost:8090/
“Functional” response
Leiningen• Automating Clojureprojects with Clojure• lein help when in trouble• http://leiningen.org/
Project setup• lein new jeeconf-clojure-webapp• cd jeeconf-clojure-webapp• Configure project in project.clj• ...more soon
Ring• Clojure library for webapplication development• HTTP abstraction = HTTPrequests are Clojure maps• https://github.com...
Project’s project.clj• Ring 1.2.0 Beta 3• Clojure 1.5.1
Project setup cont.• lein repl• (use ring.adapter.jetty)• (run-jetty handler options)• (doc run-jetty) when in trouble
“Functional” response
Ring Utils• ring.util.response• response• not-found• ring.handler.dump• handle-dump• ring.middleware.stacktrace• wrap-stac...
Responds differently based onthe URI of a requestWhat does the handler do?
Compojure• Clojure library for web routing• DSL to generate Ring handlerfunctions• http://compojure.org/
Project’s project.clj cont.• Compojure 1.1.5• Ring 1.2.0 Beta 3• Clojure 1.5.1
Project setup cont.• lein repl• (use ring.adapter.jetty)• (run-jetty handler options)• (use ‘compojure.core)• (defroutes)•...
Compojure Utils• compojure.route• files• not-found• resources• compojure.handler• api• site
Generates HTML pages basedon the URI of a requestWhat does the app do?
Enlive• Clojure library for webtemplates• Enlive template is a HTML fileand a deftemplate form• https://github.com/cgrand/...
Project’s project.clj cont.• Enlive 1.1.1• Compojure 1.1.5• Ring 1.2.0 Beta 3• Clojure 1.5.1
https://github.com/jaceklaskowski/librarian-clojurehttp://librarian-clojure.herokuapp.com/
Pitannja?JacekLaskowski @JacekLaskowskiblog.japila.plKiev, Ukraine, 24.05.2013
Introduction to Web Application Development in Clojure
Introduction to Web Application Development in Clojure
Introduction to Web Application Development in Clojure
Introduction to Web Application Development in Clojure
Introduction to Web Application Development in Clojure
Introduction to Web Application Development in Clojure
Upcoming SlideShare
Loading in …5
×

Introduction to Web Application Development in Clojure

2,468 views

Published on

My presentation about web application development with Clojure, Ring, Compojure and Enlive that I gave at JEEConf in Kiev, Ukraine - http://jeeconf.com/.

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,468
On SlideShare
0
From Embeds
0
Number of Embeds
332
Actions
Shares
0
Downloads
32
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Introduction to Web Application Development in Clojure

  1. 1. Web ApplicationDevelopmentin ClojureJacekLaskowski @JacekLaskowskiblog.japila.plKiev, Ukraine, 24.05.2013
  2. 2. Map data structure in ClojureSymbol “m” points at the map
  3. 3. Map in Clojure• Map maps keys to values• Maps are functions of theirkeys• Keywords usually keys• assoc to add key and value• dissoc to remove keys
  4. 4. “Functional” requesthttp://localhost:8090/
  5. 5. “Functional” response
  6. 6. Leiningen• Automating Clojureprojects with Clojure• lein help when in trouble• http://leiningen.org/
  7. 7. Project setup• lein new jeeconf-clojure-webapp• cd jeeconf-clojure-webapp• Configure project in project.clj• ...more soon
  8. 8. Ring• Clojure library for webapplication development• HTTP abstraction = HTTPrequests are Clojure maps• https://github.com/ring-clojure/ring
  9. 9. Project’s project.clj• Ring 1.2.0 Beta 3• Clojure 1.5.1
  10. 10. Project setup cont.• lein repl• (use ring.adapter.jetty)• (run-jetty handler options)• (doc run-jetty) when in trouble
  11. 11. “Functional” response
  12. 12. Ring Utils• ring.util.response• response• not-found• ring.handler.dump• handle-dump• ring.middleware.stacktrace• wrap-stacktrace-web
  13. 13. Responds differently based onthe URI of a requestWhat does the handler do?
  14. 14. Compojure• Clojure library for web routing• DSL to generate Ring handlerfunctions• http://compojure.org/
  15. 15. Project’s project.clj cont.• Compojure 1.1.5• Ring 1.2.0 Beta 3• Clojure 1.5.1
  16. 16. Project setup cont.• lein repl• (use ring.adapter.jetty)• (run-jetty handler options)• (use ‘compojure.core)• (defroutes)• GET et al.
  17. 17. Compojure Utils• compojure.route• files• not-found• resources• compojure.handler• api• site
  18. 18. Generates HTML pages basedon the URI of a requestWhat does the app do?
  19. 19. Enlive• Clojure library for webtemplates• Enlive template is a HTML fileand a deftemplate form• https://github.com/cgrand/enlive
  20. 20. Project’s project.clj cont.• Enlive 1.1.1• Compojure 1.1.5• Ring 1.2.0 Beta 3• Clojure 1.5.1
  21. 21. https://github.com/jaceklaskowski/librarian-clojurehttp://librarian-clojure.herokuapp.com/
  22. 22. Pitannja?JacekLaskowski @JacekLaskowskiblog.japila.plKiev, Ukraine, 24.05.2013

×