scrambler

A simple Clojure(script) app built with Duct, Reagent and cljs-ajax.

Developing

Environment

To begin developing, start with a REPL.

lein repl

Then load the development environment.

user=> (dev)
:loaded

Run go to prep and initiate the system.

dev=> (go)
:duct.server.http.jetty/starting-server {:port 3000}
:initiated

The app should be available at http://localhost:3000.

Play with the API

curl -H 'Accept: application/json' 'localhost:3000/scramble?first=abc&second='
curl -H 'Accept: application/edn' 'localhost:3000/scramble?first=abc&second=bc'

Things to try in the Clojurescript app

...so you can see error messages in action:

  • Leave one of the input boxes empty before click Check

  • Use a long string (> 40 characters)

  • Have an invalid character in one of the strings

  • Shutdown server but still use the app in browser

Reset workflow

When you make changes to your source files, use reset to reload any modified files and reset the server. Changes to CSS or ClojureScript files will be hot-loaded into the browser.

dev=> (reset)
:reloading (...)
:resumed

If you want to access a ClojureScript REPL, make sure that the site is loaded in a browser and run:

dev=> (cljs-repl)
Waiting for browser connection... Connected.
To quit, type: :cljs/quit
nil
cljs.user=>

Testing

Testing is fastest through the REPL, as you avoid environment startup time.

dev=> (test)
...

But you can also run tests through Leiningen.

lein test

Legal

Copyright © 2018 FIXME