Test project to convert http://www.reactrails.com to reagent
Here's the key functionality to support:
- Simple, single table model with no authentication.
- Handling async calls
- Simple validations, server and/or client
- Nice to show off some react features
- Deployable to heroku
- Backend of Datomic
Anything else to add to this list?
Please submit PRs!
By the way, if there's an alternative ClojureScript framework that's preferable, let me know and I'll create a separate repo to compare that one.
See also: https://github.com/shakacode/reactrails-in-om-next-example
You can set the port the web server will listen to. The app uses environ and so you can create the file `.lein-env' at the root of the project. The file should look like this:
{:port "9000"}
The app uses leiningen and npm to manage dependencies.
You need to npm install
to get javascript third party libraries.
In a terminal, after installing with npm:
lein uberjar
java -jar target/reactrails-in-reagent-standalone.jar
The following explains how to quickly get the backend and the frontend running in development.
To see the set up take a look at the file src/dev/user.clj
.
To start the backend in development start a repl with lein repl
then (go)
.
Figwheel provides auto compiling of the cljs sources and live reload. To start figwheel, in a terminal:
lein repl
(start-figwheel! "dev")
- Open your browser to
localhost:PORT/
The Gorilla REPL plugin is used to create some interactive documentation of the backend.
Worksheets are in the ws
directory. To start gorilla, in a terminal:
lein gorilla
- open your browser at the url provided.
Devcards is used in the frontend for the same purpose. To start devcards, in a terminal:
lein repl
(start-figwheel! "devcards")
- open your browser to
localhost:PORT/devcards
The project is setup using figwheel-sidecar instead of the lein-figwheel plugin. This allows for easier integration with editors, no need for a special repl config in Cursive for instance.
This page of the Gorilla REPL website explains how to connect with your text editor.
For the backend tests just lein test
in a terminal.
Karma is used to run the frontend tests. After installing the karma client, you can run the frontend tests in a terminal:
lein cljsbuild once test
karma start
You can also run the tests on the minified app (ClojureScript compiler :optimizations :advanced
)
lein cljsbuild once test-min
karma start karma.conf-min.js
The tests are also available as devcards.