Skip to content
Brenton Ashworth edited this page Jul 2, 2013 · 12 revisions

Pedestal Application Tutorial

This tutorial will show you how to build a Pedestal application. The application which we will build is very simple and yet the process of building it will demonstrate some of the most important concepts of Pedestal.

We are not sure what the final application will be but the first goal is to create a page with a single button which, when clicked, will cause a counter to be incremented. Because Pedestal is designed for building rich, collaborative applications, we will make our simple counter app rich and collaborative. Any number of users will be able to connect to the server and everyone will see everyone else's counter. Once this is working, we get a new assignment and take the application in a different direction.

This project will have both a client and server component. We will begin our work on the client.

Creating a new project

The first step is to create a new Pedestal application project.

mkdir pedestal-app-tutorial
cd pedestal-app-tutorial
lein new pedestal-app tutorial-client no-comment
cd tutorial-client

Notice that we created an outer directory named pedestal-app-tutorial to contain our project. We will eventually have a client and server project within this directory.

The command lein new pedestal-app tutorial-client no-comment will create a new app project named tutorial-client. The no-comment argument will generate a project without all of the explanatory comments.

You can run this project by running

lein repl

and then in the REPL

(use 'dev)
(start)

Open a browser and navigate to http://localhost:3000 to explore this newly created project. This project hosts a very simple "Hello World" application. To run the actual application, go to http://localhost:3000/tutorial-client-dev.html.

To see the various aspects of your application project, use the Tools Menu in the lower right corner of the browser window (hover the mouse in the lower right corner to make the tools menu appear). As we go through this tutorial, the proper use of each aspect will become clear.

We are now ready to begin.

The tag for this step is v2.0.0.

Home | Making a Counter

Clone this wiki locally