Skip to content
James Reeves edited this page May 7, 2015 · 13 revisions

Setting up

Thanks to the magic of Leiningen templates, generating a new Duct project is as easy as typing:

lein new duct hello +site +example

This will create a directory called hello containing the new project.

The +site and +example arguments are profile hints. These add extra functionality to the base Duct template. In this case, we're adding website middleware and an example endpoint.

Next, change directory into the new project:

cd hello

Once inside the project, you can optionally run:

lein setup

This will generate files for local configuration. These files allow you to customize your development environment without using files in version control.

Starting the server

You can now run your project. Duct uses REPL-based development, so you'll need to start a REPL:

lein repl

Once the REPL has loaded up, you can start the web server with:

user=> (go)

By default, the server will run on http://localhost:3000.

Every time you make changes to your source code, you can refresh your app with:

user=> (reset)

This will restart all the services associated with your application, and reload all changed source files.

Once you've finished development, you can stop the server:

user=> (stop)

Or just exit the REPL directly:

user=> (exit)
Clone this wiki locally