views.reagent/examples/todomvc
2022-01-12 18:14:40 -05:00
..
resources/public update examples 2016-05-30 17:25:57 -04:00
src/todomvc update/fix todomvc example 2022-01-12 17:18:36 -05:00
.gitignore add todomvc app example 2014-12-28 00:56:19 -05:00
create_db.sql add todomvc app example 2014-12-28 00:56:19 -05:00
pgsql.docker-compose.yml actually commit mistakenly uncommitted docker-compose files 2022-01-12 18:14:40 -05:00
project.clj bump up to stable views dependency versions in todomvc example 2022-01-12 18:01:51 -05:00
README.md update/fix todomvc example 2022-01-12 17:18:36 -05:00

views.reagent Example - Todo MVC

This is a modification of the Todo MVC app for Reagent demonstrated here. 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.

Running

Creating the Database

This example app uses a PostgreSQL database. The SQL script to create it is in create_db.sql.

A Docker compose file pgsql.docker-compose.yml is provided and pre-configured to allow you to quickly spin up a PostgreSQL database that will be pre-initialized via create_db.sql through Docker.

$ docker-compose -f pgsql.docker-compose.yml up

Alternatively, if you already have a PostgreSQL database available, you can run the create_db.sql via psql easily enough:

$ psql < create_db.sql

(Of course, add any username/host parameters you might need)

Starting It Up

To build everything and run in one step:

$ lein rundemo

Then open up a web browser or two and head to http://localhost:8080/ to see the web app in action.

If you want to run this application in a REPL, just be sure to build the ClojureScript:

$ lein cljsbuild once

And then in the REPL you can just run:

(-main)

to start the web app (you should be put in the correct namespace immediately).