views.reagent/examples/todomvc/README.md

57 lines
1.7 KiB
Markdown
Raw Normal View History

2016-05-31 10:47:22 -04:00
# views.reagent Example - Todo MVC
2016-05-23 13:53:36 -04:00
This is a modification of the Todo MVC app for Reagent [demonstrated here][1].
This version of the app has been modified to use a PostgreSQL database
to store the Todos and to provide realtime synchronization of changes
to that data to any number of users currently viewing the app.
[1]: http://reagent-project.github.io/
## Running
2016-05-25 16:30:21 -04:00
### A quick note on the dependencies used
2016-05-31 10:47:22 -04:00
Since views.reagent and the Views library it depends on are all
2016-05-23 13:53:36 -04:00
currently in somewhat of an experimental / pre-beta state right now,
you will need to first clone the following repositories and manually
install the libraries via `lein install`:
* [views](https://github.com/gered/views)
* [views-sql](https://github.com/gered/views-sql)
2016-05-31 10:47:22 -04:00
* [views.reagent](https://github.com/gered/views.reagent)
2016-05-23 13:53:36 -04:00
As well, you can install [views-honeysql](https://github.com/gered/views-honeysql)
if you want to try out using HoneySQL instead of SQL with views. But
this example app does not use it so it's not required.
2016-05-25 16:30:21 -04:00
### Creating the Database
2016-05-23 13:53:36 -04:00
2016-05-25 16:30:21 -04:00
This example app uses a PostgreSQL database. The SQL script to create
it is in `create_db.sql`. You can easily pipe it into `psql` at a
command line to create it quickly, for example:
2016-05-23 13:53:36 -04:00
2016-05-25 16:30:21 -04:00
$ psql < create_db.sql
2016-05-23 13:53:36 -04:00
2016-05-25 16:30:21 -04:00
(Of course, add any username/host parameters you might need)
2016-05-23 13:53:36 -04:00
2016-05-25 16:30:21 -04:00
### Starting It Up
2016-05-23 13:53:36 -04:00
2016-05-25 16:30:21 -04:00
To build everything and run in one step:
2016-05-23 13:56:07 -04:00
2016-05-25 16:30:21 -04:00
$ lein rundemo
Then open up a web browser or two and head to http://localhost:8080/
to see the web app in action.
2016-05-23 13:56:07 -04:00
2016-05-25 16:30:21 -04:00
If you want to run this application in a REPL, just be sure to build
the ClojureScript:
2016-05-23 13:53:36 -04:00
2016-05-25 16:30:21 -04:00
$ lein cljsbuild once
And then in the REPL you can just run:
(-main)
2016-05-23 13:53:36 -04:00
2016-05-25 16:30:21 -04:00
to start the web app (you should be put in the correct namespace
immediately).