-
Notifications
You must be signed in to change notification settings - Fork 52
Getting Started
Duct provides a Leiningen template that makes is easy to get going. To create a bare-bones project, run:
lein new duct helloThis will create a directory called hello containing the new project.
You can also provide profile hints that will set up your project with additional files and dependencies. To see which profile hints are available, run:
lein new duct :showLet's say we decide to use the +site and +example hints. We first remove the bare-bones project:
rm -rf helloThen re-run the project command with the profile hints we want:
lein new duct hello +site +exampleOnce you've created a project you're happy with, change directory into it:
cd helloOnce inside the project, you can optionally run:
lein duct setupThis will generate files for local configuration. These files allow you to customize your local development environment, without affecting the project in version control.
You can now run your project. Duct uses REPL-based development, so you'll need to start a REPL:
lein replOnce the REPL has loaded up, load up the development environment:
user=> (dev)
:loaded
dev=>Then you can start the system with:
dev=> (go)
:duct.server.http.jetty/starting-server {:port 3000}
:initiatedBy default, the web server will run on http://localhost:3000, and the example handler will be at http://localhost:3000/example.
Every time you make changes to your source code, you can refresh your app with:
dev=> (reset)
:reloading (...)
:resumedThis will restart all the services associated with your application, and reload all changed source files.
Alternatively you can have your services restart automatically on source file changes.
dev=> (auto-reset)
;; Change a Clojure or edn file
:reloading (...)
:resumedOnce you've finished development, you can halt the system:
dev=> (halt)
:stoppedOr just exit the REPL directly:
dev=> (exit)Read the Duct guide for a more complete guide