Build Your First Web App

Web Development with Clojure, Third Edition — by Dmitri Sotnikov, Scot Brown (11 / 107)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Managing Projects with Leiningen | TOC | Refine Your App 👉

In the preceding example we used the default Leiningen template to create a very simple application that has only one dependency: the Clojure runtime. If you used this as the base for a web application, then you’d have to write a lot of boilerplate to get it up and running. Let’s see how we can use a different Leiningen template to create a web-application project with all the boilerplate already set up.

Our primary goal here is to get a high-level understanding of the project structure and get something working. We’ll gloss over some of the finer details to maintain our momentum. Don’t worry if you don’t fully understand all the steps at this point. We’ll get into the details in subsequent chapters.

Creating an Application from the Luminus Template

A template is used to generate a skeleton project from certain parameters, such as the project name or which database to use. Many different templates exist to quickly create different kinds of projects. Later on we’ll even see how we can create templates ourselves. The Luminus template[7] provides a good base, and we’ll use it this time.

We can specify a template by placing it after lein new (for example, lein new my-template my-app). Any additional…

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.