Realtime CRUD data management layer/plugin for SocketCluster using RethinkDB as the database.
See https://github.com/socketcluster/sc-sample-inventory for a full working sample.
See https://github.com/socketcluster/sc-sample-inventory for sample app which demonstrates this component in action.
This module is a plugin for SocketCluster, so you need to have SC installed: http://socketcluster.io/#!/docs/getting-started Once SC is installed and you have created a new SC project, you should navigate to your project's main directory and run:
npm install sc-crud-rethink --save
Now you will need to attach the plugin to your worker - So open worker.js
and attach it to your worker instance like this:
https://github.com/SocketCluster/sc-sample-inventory/blob/e0628b312642faa60c604a27f5eb2bfbd4231e24/worker.js#L121
As shown in the sample above, you will need to provide a schema for your data. In the example above, the Category, Product, and User keys represent tables/models within RethinkDB - Inside each of these, you need to declare what fields are allowed and optionally the views which are supported for each model type.
Simply put, a view is an ordered, filtered subset of all documents within a table. Views need to define a filter
and/or order
function
which will be used to construct the view for table's data.