Book Image

Clojure Web Development Essentials

By : Ryan Baldwin
Book Image

Clojure Web Development Essentials

By: Ryan Baldwin

Overview of this book

Table of Contents (19 chapters)
Clojure Web Development Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Dependencies of the app


The Luminus template provides good starting defaults for a typical web application by using popular libraries. It also configures common tasks (such as logging) and provides a few default route handlers (URL handlers).

Taking a peek at the generated project.clj file, we see all the dependencies included by the luminus template. At the time of writing, the project.clj file produced the following dependencies:

  :dependencies [[org.clojure/clojure "1.6.0"]
                [lib-noir "0.9.4"]
                [ring-server "0.3.1"]
                [selmer "0.7.2"]
                [com.taoensso/timbre "3.3.1"]
                [com.taoensso/tower "3.0.2"]
                [markdown-clj "0.9.55"
                  :exclusions [com.keminglabs/cljx]]
                [environ "1.0.0"]
                [im.chit/cronj "1.4.2"]
                [noir-exception "0.2.2"]
                [prone "0.6.0"]]

Note

Luminus is a popular and active project, and is constantly getting better. Between now and the time this book goes to press and you purchasing one for each of your friends and yourself, it's possible that the template will have changed. At the time of writing, version 1.16.7 of the luminus template was used. If you used a more recent version your results may vary.

The first dependency should look familiar (if not, then this book isn't for you… yet). The rest, however, might appear to be a mystery. I'll spare you the effort of searching it online and break it down for you.

  • lib-noir: This contains a slough of useful utilities to create web applications using the Ring framework, such as routing, redirections, static resources, password hashing, file uploads, sessions and cookies, and so on. It's the work horse for much of the plumbing common to all web applications. Visit the following website: https://github.com/noir-clojure/lib-noir.

  • ring-server: This is a bit of an omnibus library, encompassing several other Ring-related libraries. Ring is a web application library, which acts as an abstraction between our web application (hipstr) and the underlying web server or servlet container. You can think of it as something akin to Java's Servlet API (which Ring fulfills), Python's WSGI, or Ruby's Rack. Ring Server, by contrast, is a library that starts a web server capable of serving a Ring handler. We'll get into more detail in Chapter 2, Ring and the Ring Server. To get more information about Ring Server, visit: https://github.com/weavejester/ring-server

  • selmer: This is an HTML template rendering a library modeled after the ubiquitous Django framework. Selmer allows us to generate dynamic pages, script loops and conditional rendering, extend other Selmer templates, and so on. We'll talk more about Selmer in Chapter 4, URL Routing and Template Rendering. To get more information on selmer, visit: https://github.com/yogthos/Selmer

  • timbre: Timbre is a pure Clojure logging library. It's pretty much like every other logging library on the planet, complete with somewhat confusing configuration. We'll cover Logging in Chapter 3, Logging. You can also visit https://github.com/ptaoussanis/timbre, to get more information on Timbre.

  • tower: This is similar to its sibling timbre, and is a pure Clojure library that provides support for internationalization and localization. You can refer to https://github.com/ptaoussanis/tower.

  • markdown-clj: This is a simple library that allows us to compile markdown to html. For more information, you can visit https://github.com/yogthos/markdown-clj.

  • environ: This allows us to create different application configurations for different environments (think development versus production). We'll work with environ in Chapter 11, Environment Configuration and Deployment.

  • cronj: This is a simple, straightforward library for creating cron-like scheduled tasks. To know more about cronj, visit https://github.com/zcaudate/cronj.

  • noir-exception: This provides prettified, rendered, exception stacks in the browser as well as to log files. The noir-exception library highlights your application's namespaces in their own color, easily separating your called code from the rest of the first and third party Clojure libs.

  • prone: This produces the most amazing exception reporting output you might have ever seen. (https://github.com/magnars/prone).