sharedb-server-query
ShareDB server-query plugin. It allows to subscribe to named server-defined queries. It does not deny arbitrary client queries, so use additional middleware to restrict access.
Install
With npm do:
npm install sharedb-server-query
Usage
On the server:
backend; // Add server queries // function addServerQuery accept// 'collection' - collection name// 'queryName' - name of query// 'cb' - function that accepts 'params' and runned in 'req' context// and returns a query-object or throws error backend; backend; backend;
Using queries in derby/racer:
// function serverQuery accepts 3 arguments: // 'collection' - collection name (should match one from addServerQuery) // 'queryName' - name of query (should match one from addServerQuery) // 'params' - object with query-params derby; //... var query = model; model;
What is still allowed:
// You still can use one-item fetch/subscriptionsvar itemId = paramsitemId var item = model; model; // Or justmodel;