RethinkDB-CMS
Phase 1: A livefeed of any changes to a rethinkdb datastore for consumption by client apps.
Phase 2: Providing a bare-bones (but extensible) admin for that generic JSON datastore.
Requirements
Install
npm install rethinkdb-cms --save
Phase 1
Admin of the RethinkDB is to be done via another mechanism.
I am using chateau as the CMS.
This version of rethinkdb-cms offers a live socket feed every time something updates.
Here is a sample usage of configuring a rethinkdb-cms live feed server:
var Cms = require('rethinkdb-cms');
var rdbcms = new Cms();
var r = require('rethinkdb');
r.connect({ db: 'my_rethinkdb' }).then(function(conn) {
rdbcms.setDb(conn);
rdbcms.setCollections([ 'news', 'notices' ]);
rdbcms.activateFeed({ port: 4000 });
r.table('news')
.insert({ 'content': 'Here is some NEW news!', 'updatedDts' : new Date() })
.run(conn);;
// rdbcms.stopFeed();
});
And here is the HTML for a sample client app to consume that:
<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>
<script>
var socket = io.connect('http://localhost:4000');
socket.on('update', function (data) {
console.log('I just received an update to the collection',
data.table,
', here is the new data:',
data.new_val);
});
</script>
Working Demo
https://github.com/krisrandall/rethinkdb-cms-demo
Phase 2
Develop the CMS ... this part of the project I do not see myself getting to in the short term ... I would love to but need to focus on feed-my-family work.
If you would love to donate to this project, I would love that, and it would mean I am able to do this Phase 2 part, which is the namesake of this npm module.