Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Clojure Web Development Essentials

You're reading from   Clojure Web Development Essentials Develop your own web application with the effective use of the Clojure programming language

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781784392222
Length 232 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ryan Baldwin Ryan Baldwin
Author Profile Icon Ryan Baldwin
Ryan Baldwin
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Getting Started with Luminus 2. Ring and the Ring Server FREE CHAPTER 3. Logging 4. URL Routing and Template Rendering 5. Handling Form Input 6. Testing in Clojure 7. Getting Started with the Database 8. Reading Data from the Database 9. Database Transactions 10. Sessions and Cookies 11. Environment Configuration and Deployment A. Using Korma – a Clojure DSL for SQL 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).
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image