https://github.com/socketcluster/sc-crud-rethink
Realtime CRUD data management layer/plugin for SocketCluster using RethinkDB as the database
https://github.com/socketcluster/sc-crud-rethink
Last synced: 7 months ago
JSON representation
Realtime CRUD data management layer/plugin for SocketCluster using RethinkDB as the database
- Host: GitHub
- URL: https://github.com/socketcluster/sc-crud-rethink
- Owner: SocketCluster
- Created: 2015-09-06T03:11:25.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-10-01T23:03:59.000Z (over 7 years ago)
- Last Synced: 2025-03-27T11:13:10.771Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 585 KB
- Stars: 33
- Watchers: 10
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sc-crud-rethink
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.
## Setup
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:
```bash
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.