-
Notifications
You must be signed in to change notification settings - Fork 524
Interactive Development
miikka edited this page Feb 5, 2011
·
24 revisions
If you want to reload your source files without needing to restart your adapter, you need to:
- Run your adapter in a background thread so it doesn't block your REPL.
- Pass your handler function to the adapter as a var, so it will be updated when you reload the namespace.
For example:
(future (run-jetty (var my-handler) {:port 8080}))
You can also use Lein-Ring. It's a Leiningen plugin for automating common Ring tasks. It provides a command to start a development web server that automatically reloads modified source files. Add it as a dependency to your project.clj
:
:dev-dependencies [[lein-ring "0.3.0"]]
You also need to add a new ring
key, which specifies your Ring handler function, like this:
:ring {:handler hello-world.core/handler}))
Now run the command lein ring server
to start the web server. For more information, see Lein-Ring's README.